Update 2010-05-28: If you’re using Fedora 13, then the configuration for synaptics touchpads is done through what is practically the old xorg.conf method. (This is as udev now handles devices instead of HAL.) Check out the Fedora Wiki for more information.
The Problem
Today I’ve been trying to configure the touchpad on my Eee PC 901 to my liking. It’s a Synaptics touchpad, and supports tracking multiple fingers, and I wanted to take more advantage of that.
GNOME does have support for configuring multiple finger gestures out of the box, with gnome-mouse-properties (or System » Preferences » Mouse) and then selecting the Touchpad tab. This is all good and works fine — if you’re satisfied with what GNOME gives you.
Unfortunately I wasn’t. When you enable clicking on the touchpad, GNOME sets one finger taps to left-click, two to right, and three to middle. I tend to use middle-click more often than right-click, thanks to browsing the web and liking making new tabs, plus I already have a dedicated right-click button.
So I set off to change it. After reading material courteousy of Arch Linux’s wiki, I found (and remembered from attempting the same thing ages ago) that configuration is done through the HAL using fdi policies, which are just specifically formatted XML files. (The old xorg.conf way is deprecated and isn’t as flexible, not that it matters for configuring the trackpad.)
It sounds scary and involves more typing, but in the end it’s just as simple a process as it used to be, even if it involves jumping through an extra hoop or two.
Configuration
First you have to create a file with the fdi extension in /etc/hal/fdi/policy/. I’ve named my file 99-synaptics.fdi, following example from /usr/share/hal/fdi/policy/10osvendor/, but you can name yours whatever you like.
Note: You need root permissions to be able to create and edit this file. If you run Ubuntu (or are in the /etc/sudoers file), this can be accomplished using the sudo command as shown above. You can use whatever editor you like, too. vi, emacs, nano, kate…
Once the file is created, it’s time to get messy! The fdi file contains a match rule, which tells HAL which device you want to configure, and then a series of merge rules which apply your desired configuration into the HAL. The easiest way to show this is by example, so here’s my prospective configuration:
`
synaptics
true
true
1
2
3
1
3
2
`
Starting from the top, here’s a quick description of each part:
- The <?xml part is the XML declaration required in any valid XML file. Nothing interesting here.
- The and <device> are just boilerplate code that tell the HAL to expect rules relating to devices. Again, nothing interesting here.
- Now things start getting good! The line describes how to find the device you want to configure:
- Simply put, the HAL searches for the contains string inside the key field. Whatever matches that search it’ll apply the merge rules to.
- There are other ways to match aside from contains, but this is all you need to know to get things working.
- The lines are the meat of the file, describing each and every configuration change you want to make.
You’re probably thinking this is all good and well, but how did I come up with this stuff in the first place? Well, the answer lies in the HAL itself.
The lshal command lists all the devices the HAL can detect (that’s “ls hal”, get it?). You might want to pipe the contents to less, to be able to scroll and search through the large amount of text that’s returned:
In less, type /synaptics to search for the string “synaptics”. less should automatically scroll to the point we’re interested in; your touchpad. If it cannot be found, you either don’t have a Synaptics touchpad or the synaptics driver isn’t being loaded. Try **searching for Touchpad **or similar words, but anything more than that is beyond the scope of this article.
Once you have found the device on your list, you’ll be able to see a list of keys and their values. You want to pick one of these fields that will not change between boots to place as the match rule inside your fdi file. I chose info.product, but you can choose something else like input.product if it strikes your fancy. Either way, fill in the <match> line with the key that you chose and the string that’ll match it. Ideally this search will only match your touchpad and nothing else.
Next is the fun part — configuration. To do this simply open up the man page for synaptics:
This’ll give a detailed list of everything that can be changed within the synaptics driver. For each value that you want to change, find its name on the manpage, and add a new merge rule with the appropriate key. Note that every key in the fdi begins with “input.x11_options.” followed by the synaptics key you want to change. (The exception to this in my file is the first merge rule, which just makes sure that the synaptics driver has been loaded for my touchpad.)
If you want to test an option before making it permanent, use the synclient key=value command, filling in key and value with the option you want to change.
Once you’ve added all the merge rules you like, close all the tags and save the file. Now just restart the HAL (or your computer) and your settings will be applied. Almost.
GNOME Respect
Now that you have your configuration all set up, you need to stop GNOME from changing your carefully crafted settings to ones of its choosing.
To do this, simply run the following command:
If you get cold feet and want to enable GNOME’s control over mouse and trackpad settings, run this command:
That’s really it. Thanks to jan for finding this value.
I’ve written this to be as generalised as possible, so it should work for many different distros so long as they are using the latest HAL/Xorg/kernel. I’m running Fedora 11 and have added my name to the /etc/sudoers file, allowing me to run sudo.
If you have any questions or just want to say thanks, feel free to leave a comment or contact me!