Linux with a Macbook Touchpad Feel, Pt 2

Update: Below are what I believe to be the best settings available to tune a Linux touchpad to feel like a Macbook Pro touchpad, but it still isn’t perfect, and a year of research had led me to believe that it can’t be perfect without bigger changes to the underlying Linux drivers. I’ve written this follow up post to explore paths forward.  Original post follows…

Since my last laptop upgrade to a Dell Precision, I have made it an ongoing project to try to match my laptop (running Arch via Antergos) touchpad to the smooth & predictable operation of a Macbook Pro. It has been a long road, but at this point I have a setup that I think compares favorably to a Macbook experience.

In my previous entry, I covered the three available options for Linux touchpads before settling on mtrack as my touchpad driver of choice. In the weeks since, I have walked back this decision due to the jittery behavior of the mtrack driver when one slides a thumb in an effort to click. I frequently found myself barely missing my click target, and that’s no way to live.

So I returned to review my three options. In spite of its halting development progress, the next best option seemed to be the Synaptics driver. The fact that it was initially included as the default drive for Arch added to its credibility.

Having opted for Synaptics, the foremost challenge became locating a single concise & authoritative source to explain all available Synaptics touchpad driver options. Read on for a link to that source. I will also share my current touchpad configuration, with annotations on the updates I made to maximize the consistency & elegance of my touching experience.

Installation

Since Synaptics is the default driver for many Linux distros (including Ubuntu and Antergos, to my knowledge), you might well be running the Synaptics driver already. The easiest way to determine is to run

cat /var/log/Xorg.0.log | grep synaptics

If you see output like the following, you’re in good shape:

[ 16885.807] (II) LoadModule: "synaptics"
[ 16885.808] (II) Loading /usr/lib/xorg/modules/input/synaptics_drv.so
[ 16885.808] (II) Module synaptics: vendor="X.Org Foundation"
[ 16885.808] (II) Using input driver 'synaptics' for 'DLL07BF:01 06CB:7A13 Touchpad'

If not, chances are there is a configuration file for libinput or mtrack that has a lower alphanumeric file name in either /etc/X11/xorg.conf.d/, the first directory Xorg looks for touchpad config files, or /usr/share/X11/xorg.conf.d/ its secondary location. To get your laptop to choose Synpatics over other drivers, you must change the filename of your Synaptics driver config file to have a lower alphanumeric precedence than its competitors. I.e.,

bill /usr/share/X11/xorg.conf.d $ ls -l
total 16
-rw-r--r-- 1 root root  1350 Dec 25 05:03 10-quirks.conf
-rw-r--r-- 1 bill users 1935 Jan  7 11:03 30-synaptics.conf
-rw-r--r-- 1 root root   951 Dec 20 09:24 40-libinput.conf
-rw-r--r-- 1 root root  1753 Nov 18  2016 70-mtrack.conf

In my case, my Synaptics driver config file lives at /usr/share/X11/xorg.conf.d/30-synaptics.conf. The “30-” that my config file begins with is a lower number than my libinput or mtrack config files contain, so Xorg chooses to use Synaptics and ignore the other drivers.

Configuration

In my past post, I lauded mtrack for going big on configurability, noting the 50-100 different options available on differing versions of mtrack. The good news is that Synaptics has even more options available than Mtrack. The bad news is that you’re not going to find any one complete & accurate source to learn about all of the options available to you.

This page is the best you’re going to find. It’s pretty good.

After reading through the litany of options available, and experimenting in real world usage, the final Synaptics config file I settled on actually implements relatively few custom options:

Section "InputClass"
        Identifier "touchpad catchall"
        Driver "synaptics"
        MatchIsTouchpad "on"
        # Enabling tap-to-click is a perilous choice that begets needing to set up palm detection/ignoring. Since I am fine clicking my touchpad, I sidestep the issue by disabling tapping. 
        Option "TapButton1" "0"
        Option "TapButton2" "0"
        Option "TapButton3" "0"
	# Using negative values for ScrollDelta implements natural scroll, a la Macbook default. 
        Option "VertScrollDelta" "-80"
	Option "HorizScrollDelta" "-80"
        # https://wiki.archlinux.org/index.php/Touchpad_Synaptics has a very buried note about this option
	# tl;dr this defines right button to be rightmost 7% and bottommost 5%
	Option "SoftButtonAreas" "93% 0 95% 0 0 0 0 0"  
        MatchDevicePath "/dev/input/event*"
EndSection

You’ll note that this config file doesn’t setup coasting after a two-finger scroll, since Synaptics enables this by default. The -80 values for scroll delta correspond closely with the rate at which a Macbook will scroll with two fingers. The greatest difference between my Linux and Macbook config is that I have enabled a slight area at the bottom right of my touchpad to function as my right click. After several hours of usage, I’ve found this area sized such that I only end up right clicking when I make an effort to go for the bottom right corner. It’s a handy optimization that prevents me from needing to remove right click from the touchpad entirely.

On to the finer details

The previous post lamented how challenging I had found it to tweak values for the touchpad properties without restarting Lightdm (logging out and logging in again). Since then, I’ve discovered two means that allow experimenting with different touchpad values without requiring a log out/log in cycle. Both methods will allow you to precisely configure your touchpad settings without needing to log out and log back in.

The first method is via xinput, the second via synclient.

Using xinput

The greatest benefit to using xinput directly in changing touchpad settings is that it will work with either the Synaptics, libinput, or mtrack drivers. The second method I’ll outline below (synclient) only works with Synaptics.

To configure your settings using xinput, start by running xinput --list. Note which ID corresponds to your touchpad (for me, it’s ID 13), and then run xinput --list-props id. For example:

$ xinput --list-props 13
Device 'DLL07BF:01 06CB:7A13 Touchpad':
	Device Enabled (142):	1
	Coordinate Transformation Matrix (144):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	Device Accel Profile (274):	1
	Device Accel Constant Deceleration (275):	2.500000
	Device Accel Adaptive Deceleration (276):	1.000000
	Device Accel Velocity Scaling (277):	12.500000
	Synaptics Edges (282):	49, 1179, 50, 878
	Synaptics Finger (283):	25, 30, 0
	Synaptics Tap Time (284):	180
	Synaptics Tap Move (285):	67
	Synaptics Tap Durations (286):	180, 180, 100
	Synaptics ClickPad (287):	1
	Synaptics Middle Button Timeout (288):	0
	Synaptics Two-Finger Pressure (289):	282
	Synaptics Two-Finger Width (290):	7
	Synaptics Scrolling Distance (291):	-80, -80
	Synaptics Edge Scrolling (292):	0, 0, 0
	Synaptics Two-Finger Scrolling (293):	1, 0
	Synaptics Move Speed (294):	1.000000, 1.750000, 0.129955, 0.000000
	Synaptics Off (295):	0
	Synaptics Locked Drags (296):	0
	Synaptics Locked Drags Timeout (297):	5000
        ...

Each of these property values correspond to properties you’ll find in the Synaptics configuration documentation. To change a value, you would then use xinput set-prop, for example:

xinput set-prop --type=int "DLL07BF:01 06CB:7A13 Touchpad" "Synaptics Scrolling Distance" -70 -70

You’ll note the first string is the copy-pasted name of my touchpad from xinput --list, the second string is the copy-pasted name of the setting that was shown via –list-props, and all of the settings that follow are the values to be used. After running the command above, when I re-run xinput --list-props id I see Synaptics Scrolling Distance (291): -80, -80, meaning my natural scroll is about 15% faster than before.

Using synclient

One benefit unique to the the Synaptics driver is that it comes with a dedicated utility for configuring its setting values. You can see all current applied settings by invoking synclient. You’ll see something like

$ synclient
Parameter settings:
    LeftEdge                = 49
    RightEdge               = 1179
    TopEdge                 = 50
    BottomEdge              = 878
    FingerLow               = 25
    FingerHigh              = 30
    MaxTapTime              = 180
    MaxTapMove              = 67
    MaxDoubleTapTime        = 180
    SingleTapTimeout        = 180
    ClickTime               = 100
    EmulateMidButtonTime    = 0
    EmulateTwoFingerMinZ    = 282
    EmulateTwoFingerMinW    = 7
    VertScrollDelta         = -70
    HorizScrollDelta        = -70
    ...

Again, you can consult the Synaptics settings documentation to map these esoteric names into actual behavior. Setting a new value is then simply a matter of running synclient VertScrollDelta=-80

Persisting configuration changes

After you’ve tweaked your touchpad to your satisfaction, you’ll need to propagate all your settings changes back into the config file we discussed in step one. The only bit that can make this challenging is if you used synclient, the variable names used by synclient can differ significantly from those that are known to xinput when it goes to configure your touchpad upon login.

If you’re not sure how your synclient values correspond to values you would feed to the Synaptics driver config file, use the steps from the “Using xinput” section above to list all the properties for your touchpad. Here, you’ll be able to see the config setting names that xinput knows for your touchpad, as well as the values it is currently using. For example, xinput --list-props tells me that after tweaking in synclient, I set up my button regions as follows:

Synaptics Soft Button Areas (314):	1079, 0, 760, 0, 0, 0, 0, 0

I can then copy those into my config file 30-mtrack.confas follows:

Section "InputClass"
        Identifier "touchpad catchall"
        Driver "synaptics"
        MatchIsTouchpad "on"
        ...
        Option "SoftButtonAreas" "1079 0 760 0 0 0 0 0"
EndSection

After the setting values have been saved in your configuration file, they will be applied automatically upon restart/login.

12 Replies to “Linux with a Macbook Touchpad Feel, Pt 2”

    1. Hey Anthony! Yes, I’m still using Synaptics, and I remain convinced that it is the most flexible/configurable/usable among the three Linux options available. That said, it still isn’t a Macbook. I continue to suffer from intermittent issues with pages scrolling to the bottom when I set my finger on the touchpad in the wrong way. This only happens once every day or two, but it’s very annoying and wouldn’t happen if I were on a Mac.

      I’ve grown increasingly convinced that there simply isn’t a way to get a Linux touchpad to be quality-equivalent to OS X, though not for lack of hardware. I intend to write another follow up blog post on how Linux might up its touchpad game in the future. The interest that you & others have shown in my touchpad posts implies to me that I’m not alone in hoping to someday discover the perfect Linux touchpad driver experience.

      1. I appreciate this useful information. I was trying out Linux again after having switched to Mac 10 years ago. Now, I have a Force Touch trackpad and I can’t see myself using any other trackpad. Unfortunately, it still needs more time on the Linux side before I can switch back to Linux. I’m currently dual booting with Manjaro Linux and having similar annoying issues with my trackpad. Maybe I’ll try Linux again in another year or two. Back to Mac I go then.

  1. Hi Anthony, I have recently reverted to Linux on my late 2011 17″ MBP when the discrete graphics chip died again and Apple washed their hands of it. So, thankfully I can at least use the machine and spent some time getting the mtrack implementation working. It is better than the stock synaptics implementation but not perfect, as there are a number of areas where it falls short of Apples implementation, most irritatingly brushing of palm or thumb causes the pointer to jump to a random area in the document I’m typing. Another area that doesn’t work well is the dragging of a window to a new position. So to the point of this comment, did you continue with the mtrack on your MBP and if so did you suffer from problems described? If the answer to both those questions is yes do you have a revised option set for 50-track.conf? Or did you change over to the Synaptics implementation described here for your Dell to run on your MBP?

  2. I have recently gone through the same procedure and decided to stick with synaptics for now too. Reasons are:

    libinput is made for wayland, there is a lot of goodness coming our way one can assume (https://github.com/swaywm/sway/issues/1514)
    mtrack is neat but it gives me a jittery cursor on small movements. the acceleration ability of the cursor in synaptics is quiet important IMHO.
    syntapics is damn stable. I don’t expect it to be useless before Xorg will be replaced with wayland

  3. It’s interesting seeing someone recommend the deprecated synaptics driver that has been replaced with libinput and the xf86-input-libinput wrapper, at least indicated by Arch Linux.
    https://wiki.archlinux.org/index.php/Touchpad_Synaptics

    I run Arch myself and tried to rollback to the synaptics driver for customization but unfortunately can’t because it seems to disable the keyboard but makes the touchpad work great. For now I’m sticking with the recommended libinput and messing with the config files manually. Glad you were able to get everything working though.

    1. you can use libinput for keyboard and synaptics for touchpad at the same time. i think it is by disabling the touchpad from the xinput command where it shows the touchpad detected as libinput, but keeping the one detected as synaptics. could be nonsense as this is cming from a new linux user.

  4. The process where it is much value for the user to manage it whee the Linux in MacBook which is touchpad feel the particular where t must be having the most of the part and need to make it workable around the part and need to have it.

  5. I found using the TrackPad with Linux-on-ThinkPad to be a trying experience until I read this article. Now, I might not switch back to Mac since there are some positives that balance the TrackPad drawbacks.

    One thing I’m surprised you didn’t include in your config: horizontal scrolling. It was quite simple to add (use HorizTwoFingerScroll for xinput config and “Synaptics Two-Finger Scrolling” for command-line config). Was the omission intentional? (are there downsides that aren’t immediately obvious)

  6. Mind to share your MinSpeed, MaxSpeed, and AccelFactor values from “synclient”, after been using and adjusting it for this long?

  7. Did anyone try “libinput-gestures”? It’s the standard way to get trackpad gestures. I quickly skimmed the blog posts, so perhaps I missed why it was not a viable solution. It’s not going to have the numerous exotic gestures of a MBP trackpad, but the fundamental gestures are covered quite well.

Leave a Reply

Your email address will not be published. Required fields are marked *