As I wrote a few hours ago it would be nice to be able to have a keyboard shortcut to enable/disable the touchpad. So when I started eat a chocolate cake I decided to fix the problem for Ubuntu and MSI S271. It should work in most GNOME-based Linux distributions and for most touchpads.
First I wrote a script to toggle the touchpad (download here):
#!/bin/bash
if lsmod | grep "^psmouse " > /dev/null ; then
/usr/bin/sudo /sbin/rmmod psmouse ;
else
/usr/bin/sudo /sbin/modprobe psmouse ;
fi
No rocket science here. Put the script some where on your harddrive, like /usr/local/bin. Add the following line in the end of your /etc/sudoers file:
ALL ALL=(ALL)NOPASSWD: /sbin/rmmod psmouse, /sbin/modprobe psmouse
This gives all users the right to enable and disable the touchpad.
Register your the script as a keybinding command in gconf:
gconftool-2 -t str --set /apps/metacity/keybinding_commands/command_1 "/usr/local/bin/toggle-tp.sh"
Register in the same way what shortcut key to launch the command:
gconftool-2 -t str --set /apps/metacity/global_keybindings/run_command_1 "0xb2"
I selected the webbrowser launcher-key, which have 0xb2 as keycode, to toggle my touchpad. You can find examples of other keycodes here.
Saturday, September 22, 2007
Keyboard shortcut to disable touchpad
Subscribe to:
Post Comments (Atom)
6 comments:
Thanks a lot for this tip. I was looking for something to disable my touchpad for more than 1 year!
If I wasnt a declared atheist, I would have included you in my evening prayers for the rest of my life. Typing into vim on a small eee and having the cursor jump around because my fat thumbs keep hitting the touchpad is my idea of eternity in hell. Thanks a million times for this useful piece of sweet.
Have a nice day
-- Basim
Thanks for this tip, its a great workaround for the ubuntu touchpad gsynaptics issue on eee-pcs that prevents disabling tap-to-click. I can now type term papers on my eeepc without my stupid thumbs getting in the way.
Using full gnome (I'm using Ubuntu9.04), the best way to do this is (IMHO):
From the System menu, choose Preferences and then Keyboard Shortcuts.
Scroll to the bottom, and click on the Add button at the bottom.
In the new window, enter the name:
Toggle touchpad
and the command:
/usr/bin/gconftool --toggle /desktop/gnome/peripherals/mouse/touchpad_enabled
Then you can assign whatever keyboard shortcut you like to it. I use ctrl-alt-t.
Blogs are so interactive where we get lots of informative on any topics...... nice job keep it up !!
________________________
Buy term papers
thanks for the tip. while trying i was enough of an idiot to not use visudo to edit the sudoers-file. And have had quite an interesting ride getting the possibility to sudo back again. Maybe you could make an extra warning in the post?
It works like a charm now, BTW :D
Post a Comment