Monday, April 28, 2014

Lenovo T440s touchpad configuration for X11

The new clickpad (a button-less touchpad) on the Lenovo T440s (and other newer models like the T540p) has a few issues with Linux and X11: the biggest problems are (1) when you push the pad down to click, the cursor rapidly flies off in seemingly random directions because the pad is very sensitive, and (2) the top-edge of the clickpad serves as software-emulated-buttons for the pointing stick (the classic Thinkpad red nub) and the cursor again flies off in random directions when you try to click them.

The good news is that Peter Hutterer and others have been working on the problem and the driver has been updated to fix the issues.

However, until the updated driver gets out of rawhide, I need a workaround. A quick search finds a large number of X11 configuration tweaks on various blogs and forums: Peter Hutterer, Ben Hilburn, Tim Bielawa, Major Hayden and more.

Here's the configuration tweak I am using. The AreaTopEdge setting turns off motion tracking along the top edge so the software-emulated-buttons are only buttons, and the SoftButtonAreas setting defines the edges for the right- and middle-buttons (the left-button is whatever is left over).

[jbastian@localhost ~]$ cat /etc/X11/xorg.conf.d/99-clickpad-softbuttons.conf

Section "InputClass"
    Identifier "Default clickpad buttons"
    MatchDriver "synaptics"
    MatchIsTouchpad "on"
    Option "ClickPad" "on"
    # Soft Button Areas:
    # first 4 parameters: right button left, right, top, bottom edge
    # last 4 parameters: middle button left, right, top, bottom edge
    Option "SoftButtonAreas" "65% 0 0 2600 35% 65% 0 2600"
    # use /usr/local/bin/evtest to find the value for the top edge
    Option "AreaTopEdge" "2600"
    # reduce motion from noise during click events
    # (default value of 8 is too low)
    Option "HorizHysteresis" "30"
    Option "VertHysteresis" "30"
EndSection

I'm also running syndaemon which will disable the clickpad while typing to avoid accidental cursor movements from your palms brushing on the pad.

[jbastian@localhost ~]$ cat ~/.config/autostart/syndaemon.desktop
[Desktop Entry]
Comment[en_US]=Disable Touchpad while Typing
Comment=Disable Touchpad while Typing
Exec=/usr/bin/syndaemon -d
GenericName[en_US]=syndaemon
GenericName=syndaemon
Icon=system-run
MimeType=
Name[en_US]=syndaemon
Name=syndaemon
OnlyShowIn=KDE;
Path=
StartupNotify=false
Terminal=false
TerminalOptions=
TryExec=syndaemon -d
Type=Application
Version=1.0
X-DBUS-ServiceName=
X-DBUS-StartupType=none
X-Desktop-File-Install-Version=0.21
X-KDE-SubstituteUID=false
X-KDE-Username=