Pimp up the touchpad of your notebook

  7 years ago


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 crying, unless they’re willing to get convinced…


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 wink 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"

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"

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"

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"

# 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 smiley. 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'"
# 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:

 <!-- 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>
    <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>

 <!-- 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>     

    <wish gesture="Drag" fingers="4">
      <action name="action1" when="update">
        <trigger prop="delta y" min="40" max="600"/>
        <key modifier1="Super_L">Down</key>
    <wish gesture="Drag" fingers="4">
      <action name="action1" when="update">
        <trigger prop="delta y" min="-600" max="-40"/>
        <key modifier1="Super_L">Up</key>

    <wish gesture="Drag" fingers="4">
      <action name="action1" when="update">
        <trigger prop="delta x" min="40" max="600"/>
        <key modifier1="Super_L">Right</key>
    <wish gesture="Drag" fingers="4">
      <action name="action1" when="update">
        <trigger prop="delta x" min="-600" max="-40"/>
        <key modifier1="Super_L">Left</key>


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 wink): a relatively big surface.

If you’re drawing sketches or editing photographs a lot, you can as well use a stylus enlightened 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.

Moem 4 months ago

This may be old but so is my laptop... Just adding the sample config file made my trackpoint stop acting up and being jumpy! Thank you so much!

MagicMint 7 years ago

@Auslander: I know, it’s weird that the one of all settings you need the most cannot be made persistent (although they are for me in LM 17.x now). But this sole button configuration was somehow always tricky, as far as I can remember.

I’m happy to hear that hibernation works for you on the Mac (many PC users don’t even use it). If the TapButtonx settings are lost on wakeup, then the synclient command must be called from a power manager script in /etc/pm/sleep.d/.

Auslander 7 years ago

@MagicMint: oh, one other thing I realized - this approach you've given does work, but not after waking from hibernation. I think most laptop users rarely restart these days. Any ideas on how to make sure this script is run every time the system wakes?

Auslander 7 years ago

@MagicMint: I guess I'm not explaining this very well. On my mac, the synclient settings make a distinction:

TapButton1, TapButton2, TapButton3, ClickFinger1, ClickFinger2, ClickFinger3

"Two Finger Click Emulation" and "Three Finger Click Emulation" in the Mouse/Trackpad preferences are associated with ClickFinger2 and ClickFinger3. They do work. I just ran through it with synclient. When I click all the way down on my trackpad, I can change the behavior of multi-finger clicks. All of the synclient options work on my platform.

I also use single finger tapping/double-tapping for most things. No problem there. Though totally subjective, I find it the most intuitive way to use the trackpad.

My problem is that a *two-finger tap* delivers a right-click command. Because the trackpad tuning in this edition is not as refined as OS X, that two-finger-tap command gets frequently tangled up in the two-finger-scroll command.

It feels a little ghetto to script what should be a persistent setting along with everything else, but I do appreciate the help. (In my case, I would be setting TapButton1=1, TapButton2=0, TapButton3=3)

MagicMint 7 years ago

No, there is no such thing as “two- or three-finger click” as in your understanding — the designation in the settings dialog is erroneous as it refers to tapping, actually. The problem is that according to the man page of the synaptics driver, “tapping is disabled by default for touchpads with one or more physical buttons”, hence in a Mac, the kernel seems to report no button at all, therefore tapping is enabled by default.

If you want to disable it implicitly, all you need the xorg.conf for is to set the options TapButton1 to TapButton3 to zero. Unfortunately, these are precisely the only settings which I found not to stick with certain versions of the driver when issued from within the configuration file (as mentioned above).

Thus, the best is to put the command

DISPLAY=":0" synclient TapButton1=0 TapButton2=0 TapButton3=0

into an executable script ~/bin/notap, and to call that script from a startup launcher (at the time I needed this, I had it on the panel too, for manual setting).

The story that the driver’s default settings are telling is that tapping in itself is an inherent feature of touchpads (it’s only multi-finger tapping which is a newer invention), so I still don’t really catch your problems with it: I’m routinely using them on virtually any kind of touchpads for years now. Tapping works exactly the same way in MacOS, Windows and Linux, independently of the number of physical buttons available — it’s just a question of timing to extend it to gestures

Auslander 7 years ago

Incorrect. There is a difference between touchpad 'tapping' and 'clicking.' The system settings support enabling/disabling of two and three finger "clicking" - that is, full depression of the touchpad until it clicks. There is no option to disable tapping, however. Even if I disable two and three finger clicking, I still get a right-click emulation if I two-finger tap.

This interferes with two-finger scrolling. When I go to scroll, I routinely end up selecting a bunch of text/elements, or get a right click popup menu. As a mac immigrant to Linux I understand that I'm going to lose some gestures - which is OK - but this is just basic functionality I'm trying to sort out.

I can, on a session-by-session case, use synaptic CLI to turn off multi-finger tapping but it doesn't stick; and when I create the 50-synaptics.conf file it disables the pointer movement entirely.

MagicMint 7 years ago

@Auslander: Turning off the multi-tap feature is the exact opposite of the purpose of this tutorial. If you’re on Cinnamon, you can do that as follows: System Settings› Hardware› Mouse and Touchpad› Touchpad› Two and Three Finger Emulation› Disabled.

Auslander 7 years ago

Sorry - when I said mouse in my last post, i meant touchpad :)

Auslander 7 years ago

I followed this tutorial (Macbook air) and once I logged out, my pointer became inoperable. I was able to execute a right-click by clicking once on the touchpad, but no pointer movement. Once I eliminated 50-synaptics.conf the mouse worked again.

All I'm trying to do is to turn off the multi-finger tap functionality. any help? Thanks!

MagicMint 7 years ago

@overkill22: Sorry, my fault :oops: The correct command reads:
test -d /etc/X11/xorg.conf.d || sudo mkdir /etc/X11/xorg.conf.d

overkill22 7 years ago

I'm having problem with the command
sudo test -d /etc/X11/xorg.conf || mkdir /etc/X11/xorg.conf.d

mkdir: cannot create directory ‘/etc/X11/xorg.conf.d’: Permission denied

I have no xorg.conf...

MagicMint 8 years ago

@GuizmoPhil: To clarify things, xinput reports the position of the mouse pointer, not that of your fingers. As far as LeftEdge is concerned, there is a picture in man 4 synaptics that explains the differences.

GuizmoPhil 8 years ago


I finally had time to try again this tutorial with the updated info. I need some advice regarding the touchpad size.

When I move y finger on the touchpad, I am indeed getting position.

Let's take this as an example.
motion a[0]=2475 a[1]=2703

Anything with [0] means it's moving on the X axis, and [1] on the Y axis, am I right?

When I move my finger to the left completly, I get motion a[0]=1472 from at least an inch from the touchpad border. Which makes me think that the size the OS think the touchpad is, is wrong.

When I type synclient -l, it says that the LeftEgde is 1763.

So am I right saying that the operating system does not know the correct size of my touchpad? 1472 should be the LeftEdge, right?

If this is the case, where can I configure correctly the touchpad size. All my Edges seems to be way off, I think this could explain the erratic cursor behavior I am having.

I know that this is not exactly part of the tutorial, but my touchpad is a piece of crap in Linux, I'm kind of depressed having to carry a mouse all the time.

Thanks in advance,

MagicMint 8 years ago

@GuizmoPhil: Sorry about that, but the debugging facility had been removed from synclient in the meantime. You should use xinput instead — I’ve updated the tutorial accordingly.

Configuration goes into /etc/…, thus you should _always_ edit the file in /usr/share/X11/xorg.conf.d/. However, if that directory doesn’t exist, you must create it before starting the text editor — see above.

GuizmoPhil 8 years ago


I've a couple of questions regarding this tutorial.

Using "synclient -m 1" ended up with an error as follow:
synclient: invalid option -- 'm'
Usage: synclient [-h] [-l] [-V] [-?] [var1=value1 [var2=value2] ...]
-l List current user settings
-V Print synclient version string and exit
-? Show this help message
var=value Set user parameter 'var' to 'value'.

After googling around, it seems that the "-m" option has been completely removed from the synclient 1.7.x. Do you know how to downgrade to 1.6.x? I am running on Rebecca.

Also, I could not find any directory "xorg.conf.d" in /etc/X11/, I could only find the 50-synaptics.conf file in /usr/share/X11/xorg.conf.d/.

Do I need to edit the file in /usr/... or do I need to create one in /etc/...?

Thanks in advance,

MagicMint 8 years ago

@Wild_Penguin: The problems you’re experiencing must be related to your system’s configuration somehow. In Rebecca, everything still works for me as it did in Nadia.

leonidas79 8 years ago

Just install new kernel version (for now 3.16.0-28) via Update manager->View->Linux kernel. This solves problem for me.

Wild_Penguin 8 years ago

Too bad ginn doesn't work anymore. Also, disabling touchbad while typing does not work, either. Putting the above file in /etc/X11/xorg.conf.d will freeze the whole touchpad. So, a new up-to-date guide is needed! I'm trying to figure things out and will comment here if I get something done =)

MagicMint 9 years ago

You should try to deduce your SoftButtonAreas from the dimensions of your touchpad which should be (LeftEdge + RightEdge) × (TopEdge + BottomEdge). Anyway, you have a ClickPad = 0 in your parameters, so the touchpad doesn’t seem to have soft buttons ?!

kamudhar 9 years ago

I am a right handed touchpad user on LinuxMint 16 (64 bit Cinnamon edition). My 50-synaptics.conf file is an exact replica of the one given in this tutorial.
synclient -m 1 tells me that there is no option -m to the command synclient.
synclient -l gives me the following output:
Parameter settings:
LeftEdge = 1752
RightEdge = 5192
TopEdge = 1620
BottomEdge = 4236
FingerLow = 25
FingerHigh = 30
MaxTapTime = 180
MaxTapMove = 221
MaxDoubleTapTime = 180
SingleTapTimeout = 180
ClickTime = 100
EmulateMidButtonTime = 75
EmulateTwoFingerMinZ = 29
EmulateTwoFingerMinW = 5
VertScrollDelta = 100
HorizScrollDelta = 100
VertEdgeScroll = 1
HorizEdgeScroll = 0
CornerCoasting = 0
VertTwoFingerScroll = 0
HorizTwoFingerScroll = 0
MinSpeed = 1
MaxSpeed = 1.75
AccelFactor = 0.102881
TouchpadOff = 0
LockedDrags = 1
LockedDragTimeout = 5000
RTCornerButton = 0
RBCornerButton = 0
LTCornerButton = 8
LBCornerButton = 0
TapButton1 = 1
TapButton2 = 0
TapButton3 = 0
ClickFinger1 = 1
ClickFinger2 = 1
ClickFinger3 = 0
CircularScrolling = 0
CircScrollDelta = 0.1
CircScrollTrigger = 0
PalmDetect = 1
PalmMinWidth = 4
PalmMinZ = 1
CoastingSpeed = 20
CoastingFriction = 50
PressureMotionMinZ = 30
PressureMotionMaxZ = 160
PressureMotionMinFactor = 1
PressureMotionMaxFactor = 1
ResolutionDetect = 1
GrabEventDevice = 1
TapAndDragGesture = 1
AreaLeftEdge = 0
AreaRightEdge = 0
AreaTopEdge = 0
AreaBottomEdge = 0
HorizHysteresis = 25
VertHysteresis = 25
ClickPad = 0
What should I change in the 50-synaptics.conf file? I sense that I need to change this line:
Option "SoftButtonAreas" "I don't know what to put here".

Can someone help? Also, can I continue to follow this tutorial after I input the right coordinates?

MagicMint 9 years ago

The file you’re trying to open is is just a sample configuration that you don’t really need. Take the example discussed in the tutorial as a starting point, which must be saved as explained (don’t forget sudo!) into the real configuration directory of X11 which is /etc/X11/xorg.conf.d/, by the way.

If you need to modify it, read “man 4 synaptics” for details.

MagicMint 9 years ago

If you have basic problems to get the touchpad to work at all, there is a good guide on Ubuntu Wiki about debugging it: https://wiki.ubuntu.com/DebuggingTouchpadDetection.