Disabling the touchpad while typing on Linux
September 22, 2009,
For non touch-typists, the touchpad or trackpad may be inadvertently triggered while typing, causing the cursor to be repositioned, with various consequences. Fortunately, a little tool exists for Linux that disables the touchpad while typing, preventing this.
All modern notebooks come with a touchpad that allows users to work mostly as if a mouse were attached, but without the need of carrying around additional hardware, or trying to make room to allow the mouse to actually move. The downside of a touchpad is that it is located directly below the keyboard. Being somewhat hamfisted, and definitely not a touch typist, this proves to be a problem to me. While typing, I regularly brush the touchpad with the palm of my hand, moving the cusor to some other part of a text, or even to another control, of course without me noticing, since I am watching the keyboard. The result is a lot of frustration and constant corrections. My previous notebook was a nice IBM Thinkpad, which has a trackpoint, so I solved this issue by completely disabling the touchpad in the BIOS. Since its demise, I have a basic Acer notebook without a trackpoint, forcing me to look for a more thorough solution. And recently I also got myself a little Samsung N110 netbook (on which I'm typing this) to carry on vacations and similar occasions because it's light and has very good battery life, but because of its size I have an even bigger problem with the touchpad getting in my way.
Fortunately, the solution is relatively simple. The trick is to disable the touchpad when a key is pressed, but automatically enable it again if no key is pressed for a certain interval. The tool that does exactly that is called syndaemon. Since it's a daemon, it runs in the background, and you can start it automatically at the beginning of your login session. Syndaemon is available for all Linux distributions I'm aware of. Since I'm running Ubuntu Netbook Remix (UNR), I'll address setting up syndaemon for this distribution, but similar procedures apply for other recent distro's. The utilities for controlling the touchpad under UNR are part of the package xserver-xorg-input-synaptics, so make sure this is installed.
The next point is to make sure that Xorg allows access to the shared memory the touchpad driver uses. For this, you need to enable SHMConfig. For UNR, you can find detailed instructions here. After restarting Xorg, syndaemon should be fully functional, which you can test by starting it from the command line with a fairly long interval to make sure it is working correctly. For example, try
syndaemon -i 5
and try the touchpad. It should not work for 5 seconds after the last keypress. Once you verified it works, try to work out a suitable interval for disabling the touchpad. The default is 2 seconds, which is a bit too long for me, so I use 1.5 seconds. You'll probably adjust this parameter a few times until it suits your typing behaviour. The next step is to start syndaemon when you log in. Ubuntu has a facility under Preferences that allows you to define startup applications. Add syndaemon here, with the correct parameters. These should be at least -d to make sure it runs as a daemon, and probably your personal interval. There are a few other options to play with, see the syndaemon man page. From now on, you should have no problems with the touchpad interfering with your typing.