Scope

Although equipped with a very capable driver by now, the standard installation brought up the touchpad of my Asus UX-32A Zenbook in a state in which it was indeed usable from the first moment on, but without any of its more advanced features. Thus the right button click and one-finger scrolling worked, but there wasn’t any multi-finger gesture. As far as I know, these features work only for newer models of Synaptics or Elantech, which was the case of the touchpad of my notebook. The vendor of an already working touchpad is revealed by a quick command:

…$ xinput | grep -i touchpad

As there is definitely more to it in Linux, although at the cost of some manual configuration, here is a detailed description about how to come up to the perfection of a MacBook’s touchpad under Mac OS X. This comparison suggests it already: we’re dealing here first and foremost with newer clickpads, i.e. with touchpads that like Apple’s one do not have any physical buttons. However, beside the soft buttons the following applies also to other types of touchpads, provided that they’re serviced by the synaptics driver. Chances are that this is the one you are using if your notebook has a touchpad, but the version of the driver is important (it should be at least v1.6.x), so let’s check it out:

…$ apt-show-versions | grep input-synaptics

And don’t forget, this tutorial is not for mouse lovers , unless they’re willing to get convinced…

Configuration

First of all, mark the following functions in the Touchpad section of the “Mouse and Touchpad” settings:

Enable touchpad

Tap to click

Disable touchpad while typing

Two-finger scrolling

Enable horizontal scrolling

The secrets of the driver’s extended abilities are hidden in the file /usr/share/X11/xorg.conf.d/50-synaptics.conf which we must only adapt to our needs. While one can elucidate the options therein with a simple command man 4 synaptics, we’ll also need the synclient command (which is part of the driver package) to measure the dimensions of the soft buttons of the clickpad later on.



It is easier to start out with a working example, so enter in a terminal:

…$ test -d /etc/X11/xorg.conf.d || sudo mkdir /etc/X11/xorg.conf.d …$ sudo gedit /etc/X11/xorg.conf.d/50-synaptics.conf

If the file isn’t empty, somebody has made it up already and you’ll merely have to add the options which you’re interested in, otherwise just paste in the following contents as a whole:

# /etc/X11/xorg.conf.d/50-synaptics.conf (MagicMint) M0427 # Additional options may be added in the form of # Option "OptionName" "value" # See man synaptics (4) for details Section "InputClass" Identifier "touchpad ignore duplicates" # Ignore events from old driver MatchIsTouchpad "on" MatchOS "Linux" MatchDevicePath "/dev/input/mouse*" Option "Ignore" "on" EndSection Section "InputClass" Identifier "touchpad catchall" # Device Driver "synaptics" MatchIsTouchpad "on" MatchDevicePath "/dev/input/event*" # Palm detection Option "PalmDetect" "on" Option "PalmMinWidth" "4" Option "PalmMinZ" "1" # Dragging & tapping Option "LockedDrags" "on" Option "FastTaps" "on" Option "AccelFactor" "0.1028806" #2x Option "MinSpeed" "1" Option "MaxSpeed" "1.75" EndSection Section "InputClass" Identifier "Default clickpad buttons" # Lacking mouse buttons MatchDriver "synaptics" Option "LTCornerButton" "8" # Left-handed pad w/ middle button on the left side #Option "SoftButtonAreas" "1630 0 1737 0 0 1629 1737 0" # Right-handed pad w/ middle button on the right side Option "SoftButtonAreas" "0 1629 1737 0 1630 0 1737 0" EndSection Section "InputClass" Identifier "Multi-finger taps" MatchDriver "synaptics" # The following worked in Nadia only via synclient Option "TapButton1" "1" Option "TapButton2" "3" Option "TapButton3" "2" EndSection # End of configuration file

1. Section: Touchpad ignore duplicates

The duty of this section is to filter out touchpad events which would be potentially duplicated otherwise by a legacy driver, causing that way a race condition between both drivers which could prevent the touchpad from functioning properly.

2. Section: Touchpad catchall

This section is committed to the actual configuration of the touchpad. The options therein are self-explaining; in case of a doubt or extra wishes please refer to the manual page aforesaid. The acceleration factor is for instance the double of its original value — we’ll see in a moment how to measure that.



The point of this configuration file is, that for almost all settings of the touchpad, this is the only place where they will be remembered across sessions: most graphical utilities in GNOME, for example, do not guarantee this and in addition they’re incomplete at most.

3. Section: Default clickpad buttons

As we all know, PC mouses use to have more than just one button. Hence, even a clickpad like mine that has none pretends to have three of them:



1. left mouse button 2. right mouse button 3. middle mouse button

Assigning the right mouse button to the left of the clickpad is the right-handed variant in the file above, since this is the only way to use mouse gestures bound to the right button (in Opera, Firefox, etc.) with the thumb of the right hand.



Anyway, as touchpads differ in size, it is advisable to enter the exact coordinates of the four corners of such a soft button mimicked by the clickpad. In order to do so, with the brand new configuration file in effect, log out from your graphic session and log in anew. With the command

…$ xinput test ID_number_from_the_very_first_command

typed in a terminal, you can now easily find out these coordinates which you must then write down, of course. At this point you can also experiment with the speed settings of the pointer by listing and setting them via synclient:

…$ synclient -l …$ synclient AccelFactor=0.12345678

Closing the active window

The top left corner of the touchpad is assigned to a fictitious mouse button number 8 which will be used to close the active window on the screen. The choice of the top left corner follows from a right-handed view again, since it is out of any accidental reach of the right hand. (To be consistent with this, I’ve also re-arranged the window buttons in cinnamon — I’m a bit of nostalgic about Mac OS’ differences to Windows . You can achieve this by setting the leftmost title bar button in cinnamon’s windows settings to "close".



This is a kind of automation task, so we need, well, the package xautomation. Furthermore, we should also install xbindkeys to realize the closing of a window with an emulated mouse button:

…$ sudo apt-get install xautomation xbindkeys

The linking between the two is done automagically by the file:

…$ gedit ~/.xbindkeysrc

Its contents should be the following:

# ~/.xbindkeysr (MagicMint) H0129 # Bind the 8th mouse button to close the current window "xte 'keydown Alt_L' 'key F4' 'keyup Alt_L'" b:8 # End of xbindkeys configuration

4. Section: Multi-finger taps

This section is appointed in theory to instantiating the multi-finger tap support of the driver in a way such that the number of fingers used to tap be the same as the figures in the illustration above, making thus the tap behave in the same manner as the corresponding soft button.



Ultimate usage

For the time being, the synaptics driver cannot recognize more complex gestures such as pinching, rotating, etc. But nevertheless you can add them to the repertoire of your touchpad by means of ginn, a utility meant to incorporate legacy applications into Unity’s gesture schema in Ubuntu (if you have trouble getting it to work, try touchegg instead):

…$ sudo apt-get install ginn

In our installation we use it to provide 4 finger gestures (anything below this number of fingers is seized by synaptics). With that many fingers the “pinch” gesture didn’t work for me, so the following makes only usage of rotate, tap and drag to perform 7 standard actions on the active window (summarized at the end of this tutorial). Please verify in your keyboard’s shortcuts settings if the keys given match the desired actions, for example Shift + Super (Windows) + Down to minimize a window, and don’t forget to enable window tiling and snapping in cinnamon’s corresponding settings:



You should replace the contents of the sample configuration file:

…$ sudo gedit /etc/ginn/wishes.xml

by the following contents and install ginn as an autostart program (under Menu› Preferences› Startup Applications), thereby activating it after the next log in:

<ginn> <global> <!-- Application control --> <wish gesture="Rotate" fingers="4"> <action name="rotateccw" when="update"> <trigger prop="angle delta" min="-1.5" max="-0.08"/> <key modifier1="Control_L">plus</key> </action> </wish> <wish gesture="Rotate" fingers="4"> <action name="rotatecw" when="update"> <trigger prop="angle delta" min="0.08" max="1.5"/> <key modifier1="Control_L">minus</key> </action> </wish> <!-- Windows control --> <wish gesture="Tap" fingers="4"> <action name="action1" when="update"> <trigger prop="tap time" min="20" max="400"/> <key modifier1="Super_L" modifier2="Shift_L">Down</key> </action> </wish> <wish gesture="Drag" fingers="4"> <action name="action1" when="update"> <trigger prop="delta y" min="40" max="600"/> <key modifier1="Super_L">Down</key> </action> </wish> <wish gesture="Drag" fingers="4"> <action name="action1" when="update"> <trigger prop="delta y" min="-600" max="-40"/> <key modifier1="Super_L">Up</key> </action> </wish> <wish gesture="Drag" fingers="4"> <action name="action1" when="update"> <trigger prop="delta x" min="40" max="600"/> <key modifier1="Super_L">Right</key> </action> </wish> <wish gesture="Drag" fingers="4"> <action name="action1" when="update"> <trigger prop="delta x" min="-600" max="-40"/> <key modifier1="Super_L">Left</key> </action> </wish> </global> </ginn>

The ultimate tip

Besides having a highly configurable driver, modern clickpads offer another advantage too (although this is often seen as a serious disadvantage by many — otherwise there would be no extra key to switch them off ): a relatively big surface.



If you’re drawing sketches or editing photographs a lot, you can as well use a stylus for touchscreen devices like the iPad — this could definitively replace your mouse, as it does for me.

Summary of touchpad actions

Action Fingers 1 2 3 4 press left click: action right click: context menu,

begin browser gesture middle click: paste — tap right click: context menu minimize window top left corner tap close window — — — drag up move browser gestures (press only) — push tile up drag down — push tile down drag right — push tile right drag left — push tile left rotate right — — — increase zoom level rotate left — — — decrease zoom level

In case of basic problems

For troubleshooting, please refer to this resource on the Archlinux wiki.