Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Since my default sony vaio shortcuts don't completely work in Ubuntu 12.04, I'd like to assign a script to Fn + F1, which toggles the touchpad on and off, so that the cursor would stop moving while I'm typing. Since I use a mouse and rarely need to use the touchpad, I don't want to use "disable touchpad while writing", which doesn't really seem to work anyway.

I figured that using a script with the following command (this works, but I have to open up a terminal each time):

xinput set-prop 12 "Device Enabled" 0

I have two problems at this point. One is that I don't know how to write this script so that it will toggle it off if it is on, and on if it is off. I know I should use an if statement but I don't know what value I should be checking to see if it is on or off.

The second one is that I am having problems creating a new shortcut. I use System Settings -> Keyboard -> Shortcuts. I tried to add, to custom shortcuts, a new one by clicking the '+' sign. I named it Toggle Touchpad, and added the path to the executable script with the line above, by typing

/home/irem/.toggletouchpad

I have made it an executable with chmod. The problem is that when I click apply, and then click back on it to define the keystroke, it re-opens the dialogue. I cannot define new keys. (It says disabled on the right column of the entry).

I have also tried xbindkeys, which almost constantly crashes. I'd prefer the system settings, if I can set the shortcut.

I'd appreciate if anyone can help. Thanks.

share|improve this question
    
look at my answer here askubuntu.com/questions/141479/… I've used fn+f3 to toggle touchpad. –  virpara Sep 9 '12 at 10:15
1  
Thanks. My problem is that nothing happens when I try to set fn+f1, but if I try alt+g for instance, it seems to work. For some reason I cannot get it to recognize fn. –  sodiumnitrate Sep 9 '12 at 10:42
add comment

1 Answer 1

This is late, but in case you're still struggling with this. EDIT: If you're wondering why I couldn't put this as a comment on your original question, I don't have enough points (50 needed) :o

Try using the xev command in a terminal and then hit fn+f1.

If nothing shows up in your terminal then it means your combination is indeed not recognized. It's also possible that only the certain key you hit while holding fn shows up. (f1 in your case)

For example if I hold fn and press r I just get the same output I'd get if I weren't holding fn.

When the combination is possible the way to refer to that key starts with XF86 and then something added (for my touchpad toggle it is XF86TouchpadToggle for example), atleast this is true for my computer, I don't know if it could be different for you.

This is the output I get after combining fn+f9.

KeyRelease event, serial 49, synthetic NO, window 0x3200001,

root 0xcc, subw 0x0, time 29885150, (-1401,-268), root:(300,600),

state 0x10, keycode 199 (keysym 0x1008ffa9, XF86TouchpadToggle), same_screen YES,

XLookupString gives 0 bytes:

XFilterEvent returns: False

The bold part is the word that you can use if you need it to add shortcuts.

Hope this helps, even if you've already fixed the problem. ;)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.