Ubuntu Touchpad toggle tweak

I’ve been getting irritated with the touchpad on this new Dell Vostro 1400. I type for a while, and then my palm touches the touchpad, sending the pointer skimming into the line above, or clicking on buttons I don’t want to click on. So, I looked around and figured out a solution. Over the past two years, I’ve had to update this post for every single new version of Ubuntu, which has been a pain, so look for the heading below which corresponds to your version of Ubuntu.

Ubuntu Hardy 8.04

First of all, you need to edit your /etc/xorg.conf file, for which you’ll need root privileges – use sudo.You just need to add one line in the input device section, which is the one in bold below. (Intrepid 8.10, see below)

Section "InputDevice"
        Identifier      "Synaptics Touchpad"
        Driver          "synaptics"
        Option          "SendCoreEvents"        "true"
        Option          "Device"                "/dev/psaux"
        Option          "Protocol"              "auto-dev"
        Option          "HorizEdgeScroll"       "0"
        Option          "SHMConfig"

OK, now after you restart X, by logging out and in again, you can turn off the touchpad with

    synclient TouchpadOff=0

And on with

    synclient TouchpadOff=0

I put this together in a script which will look to see if it is on or off, and toggle it to the opposite.

if synclient -l | grep TouchpadOff | grep 1
    synclient TouchpadOff=0
    synclient TouchpadOff=1

I attached the script to an icon in my toolbar using the Add to Panel > Launcher route. Now I just have to click to toggle it off and on.

Ubuntu 8.10, Intrepid Whatsit

While the script above still works, editing xorg.conf doesn’t work any more, as Ubuntu is moving functionality out of that file. So, instead of that we create a file here.

sudo nano /etc/hal/fdi/policy/shmconfig.fdi

and cut and paste the following into it, saving afterwards.


This file only works with Synaptics Touchpad driver. If you have another touchpad, the filename may be different. There are hundreds of other options which you can activate in this file, but the SHMConfig line is the one you need to allow the script to work.

OK, now you’ve done that, the commands and script above should work.

Ubuntu 9.04 Jaunty Jackass

…. it should work unless you upgrade to 9.04 that is. Now neither of those methods work for disabling the touchpad, which is causing me no end of irritation. So now there’s a third solution which I discovered after finding the new touchpad control panel under System > Preferences > Mouse > Touchpad. In there there is a switch to turn off the touchpad, so I figured there must be a way to change this setting with gconftool. Here’s what  came up with:

gconftool-2 –toggle /desktop/gnome/peripherals/mouse/touchpad_enabled

This works from the commandline, in a script and even typed directly into a launcher button on your menubar for lightning fast toggling. Which is the only way to toggle.

Ubuntu 9.10 Karmic Koala

Why do they have to change this every frigging version. OK, so back to a script into which the following is inserted.

if xinput list-props "SynPS/2 Synaptics TouchPad" | grep "Device Enabled" | grep 1
    xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 8 0
     xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 8 1

Then assign this to a key (in my case F6) using System > Preferences > Keyboard Shortcuts. All seems to work again … until the next upgrade.

3 thoughts on “Ubuntu Touchpad toggle tweak

  1. It is much simpler under Ubuntu 9.04 Jaunty Jackass.
    Just enable SHMConfig through that .fdi file of yours, and use:
    synclient TouchpadOff=1 to turn off the touchpad
    synclient TouchpadOff=0 to turn it on

    (I hate this reversed behavior…enabling the Off function, grrr!)

  2. Hi karatedog.

    Yup, I’m not keen on how things keep changing from version to version. The fix you describe works for 8.10, but I find the option for 9.04 which I describe above even easier. I basically replaced my script with this line

    gconftool-2 –toggle /desktop/gnome/peripherals/mouse/touchpad_enabled

    … and then assigned it to a hotkey in System > Preferences > Keyboard Shortcuts. So now all I do is press ctrl-alt-f6 and it toggles from one state to another. This means I can even turn my touchpad off when I don’t have a mouse plugged in, and just want to type for a while without interruption. Neat.

Leave a Comment