Enable Disable Touchpad in Ubuntu with a Hot key

I have got this new Dell Vostro n3500 Laptop, which is really a solid machine. I am very happy to have made this choice.

As a hardcore UBUNTU User, I always liked to have any feature available in Windows to be made available in Ubuntu as well :)…

Recently, I realized that the “Fn+F6” shortcut to disable the Touchpad does not work… I am sure many of you would have encountered the annoying behavior of touchpad moving your cursor to some place while you are typing something…

The most ideal solution I would have liked is that, when I connect an external mouse, the touchpad should automatically be disabled. Apparently, I did not find any solution for this in the current version of Ubuntu 10.04(Lucid Lynx). Google did not help me either.

So, the next thing is, is there any way I can tell Ubuntu to disable touchpad when I start typing. Yes, there is such an option in the “Mouse Preferences”. But that is not working consistently atleast for me.

So, now this is what I did. I wrote a small Ruby script(I am a big big fan of Ruby) that can toggle the Touchpad ON and OFF.

Now, the next thing is to make it hooked to a keyboard shortcut like the one in Windows…Fn+F6. Apparently, I also found that I cannot assign the combination of “Fn” Key and “F6” to the Keyboard shortcut in Ubuntu. So for now, I have simply assigned “F6” key for this toggle switch tool.

The script is not a big deal, but in any case, its here…

touch_pad_setting = `synclient -l | grep TouchpadOff`
new_touch_pad_setting = touch_pad_setting =~ /1/ ? "0" : "1"
`synclient TouchpadOff=#{new_touch_pad_setting}`
Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to Enable Disable Touchpad in Ubuntu with a Hot key

  1. Anonymous says:

    Can you explain how to use the ruby script in more detail?

    Like

  2. Add the below shebang line as your first line in the script and mark it as executable!
    #!/usr/bin/ruby

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s