Knowledge for the World

The Perfect (almost) Touchpad Settings on Linux

The touchpad on my macbook is my #1 concern about switching to linux full time. The option set for touchpad drivers on the Macbook are as follows: Synaptics, libinput, and mtrack. They all have their flaws. Usually it's palm detection, ignoring the thumb resting on the touchpad, and not having enough settings to emulate the "feel" of the macbook's touchpad.

Mtrack + a ton of testing configuration has come the closest and addresses all of my concerns. The main problems it solved for me are the following:

  1. sufficient palm detection (libinput is great as well, synaptics not so much)
  2. sufficient thumb detection (since I always rest my thumb on the touchpad while tracking)
  3. ignoring the thumb during click (since I wish to perform a single click with my thumb while my pointer is still on the touchpad)
  4. having sufficient settings to customize the feel

Here's how to replicate my setup.

1

Mtrack is a touchpad driver written for the Xorg display server. If you are using something else, you are out of luck. If you don't know if you're using it, the odds are in your favor. To be 100% sure, run a:

ps -e | grep X

If you see "Xorg" in the list, you're good to go.

To install, we're going to use a forked repository of the mainline mtrack. It has some very vital features to emulate the macbook feel. Use the following commands:

cd /tmp
git clone https://github.com/p2rkw/xf86-input-mtrack.git
cd xf86-input-mtrack
./configure --with-xorg-module-dir=/usr/lib/xorg/modules
sudo make
sudo make install

I did not require any additional dependencies but you might. If you do, try running the following:

sudo apt build-dep xserver-xorg-input-mtrack
2

Write the following file using your favorite text editor: /usr/share/X11/xorg.conf.d/50-mtrack.conf

And the contents:

Section "InputClass"
        MatchIsTouchpad "on"
        Identifier      "Touchpads"
        Driver          "mtrack"
        Option          "Sensitivity" "0.60"
        Option          "FingerHigh" "5"
        Option          "FingerLow" "1"
        Option          "IgnoreThumb" "true"
        Option          "ThumbRatio" "70"
        Option          "ThumbSize" "25"
        Option          "IgnorePalm" "true"
        Option          "TapButton1" "0"
        Option          "TapButton2" "0"
        Option          "TapButton3" "0"
        Option          "TapButton4" "0"
        Option          "ClickFinger1" "3"
        Option          "ClickFinger2" "3"
        Option          "ClickFinger3" "3"
        Option          "ButtonMoveEmulate" "false"
        Option          "ButtonIntegrated" "true"
        Option          "ClickTime" "25"
        Option          "BottomEdge" "30"
        Option          "SwipeLeftButton" "8"
        Option          "SwipeRightButton" "9"
        Option          "SwipeUpButton" "0"
        Option          "SwipeDownButton" "0"
        Option          "SwipeDistance" "700"
        Option          "ScrollCoastDuration" "500"
        Option          "ScrollCoastEnableSpeed" ".3"
        Option          "ScrollUpButton" "5"
        Option          "ScrollDownButton" "4"
        Option          "ScrollLeftButton" "7"
        Option          "ScrollRightButton" "6"
        Option          "ScrollDistance" "350"
EndSection
3

The command to do this varies based on your system but rebooting is a sure fire way to get it done.

4

You can read the details of the available settings at the driver's Github page.

The ones you will probably want to adjust are:

Sensitivity - to adjust the pointer speed and ScrollDistance - to adjust the scroll speed with 2 finger scrolling

Everything else comes as close as possible to the macbook's touchpad feel.