Hi! This is a guide of how to use the Apple Magic Trackpad in Qubes OS, and is specially meant for people like me who suffer from carpan tunnel.

It looks like touchpads and very thin keyboards are the only thing that save me from suffering this Wizard Wrist pain.

I really hate Apple, but I must admit that their Magic Trackpad worked incredibly well in their operating system. And, although being one of those that hates touchpads, I have to say that the Apple Magic Trackpad is so well designed that I even prefer it over mouses.

I began my journey in Qubes OS a little bit more than 2 months ago. I migrated from the Apple Ecosystem. When I entered the Apple Ecosystem, I had a very problematic carpan tunnel syndrome. I had to use the left hand for the mouse. Although I prefer my right hand, I am ambidextrous so it isn't that a big deal right? Well, it turns out that my left hand won't be free of this disease, so I will have this horrendous pain in both wrists. This sucks. When I tried the Apple Magic Trackpad, hoping for my disease to disappear, IT WORKED. I mean, you can probably use a Logitech touchpad and you will also be fine. But I bought the Apple one because I was a very hardcore Apple fanboy (I bought TONS of different devices from them). Using a touchpad results in my wrists not having that tension in the tendons or whatever suffers from that unnatural hand position, so I can continue hacking for hours and hours and hours. I cannot play more shooters or LoL tho...

So, if you have the same issue as me, I highly recommend you buying a touchpad (or if you use a laptop, stick to it).

In this tutorial, I will show you how I am setting up my Apple Magic Trackpad. I don't know if other different models differ from my config because I have never felt the need to replace this wonderful touchpad. Also, this is my current config, but I will keep posting here more upgrades as I continue to upgrade my User eXperience until I reach something similar to macOS.

Man, the only thing I envy from Apple is their wonderful touchpad integration and their incredible battery life of their laptops. Hopefully in a future we have an ARM based QubesOS iso :c (IMHO more priority than Qubes Air, just sayin, dont get mad with me pls)

Okay, let's start! First of all, I have to give @vxc credits for his solve at this post for pointing out those 2 files and the libinput thing. I didn't like the lack of detail of his solve, so this is the purpose of this post.

Let's get this touchpad going: 1. I first enabled trackpad going to the "Qubes Global Config" > "USB devices" > "Touchscreen/Tablet" > "enable" 2. Then, in dom0 we install libinput-utils: sudo qubes-dom0-update libinput-utils 3. Then, we list the trackpad in dom0: sudo libinput list-devices and the result is this:

Device:           sys-usb: Apple Inc. Magic Trackpad
Kernel:           /dev/input/event15
Group:            9
Seat:             seat0, default
Size:             162x115mm
Capabilities:     pointer gesture
Tap-to-click:     disabled
Tap-and-drag:     enabled
Tap drag lock:    disabled
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: disabled
Calibration:      n/a
Scroll methods:   *two-finger edge 
Click methods:    *button-areas clickfinger
Disable-w-typing: enabled
Disable-w-trackpointing: enabled
Accel profiles:   flat *adaptive
Rotation:         n/a

Device:           sys-usb: Apple Inc. Magic Trackpad
Kernel:           /dev/input/event16
Group:            10
Seat:             seat0, default
Size:             162x115mm
Capabilities:     pointer gesture
Tap-to-click:     disabled
Tap-and-drag:     enabled
Tap drag lock:    disabled
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: disabled
Calibration:      n/a
Scroll methods:   *two-finger edge 
Click methods:    *button-areas clickfinger
Disable-w-typing: enabled
Disable-w-trackpointing: enabled
Accel profiles:   flat *adaptive
Rotation:         n/a

As you can see in this line "Device: sys-usb: Apple Inc. Magic Trackpad", this is my model. You may have this one: "Device: sys-usb: Apple Inc. Magic Trackpad 2". Keep that in mind.

  1. Last, config the 2 files shown by @vxc. I'm writing this data:

/etc/X11/xorg.conf.d/30-touchpad.conf:

Section "InputClass"
    Identifier "touchpad"
    Driver "libinput"
    MatchIsTouchpad "on"
    #Option "ClickMethod" "clickpad"
    #Option "ClickMethod" "buttonareas"
    #Option "ButtonMapping" "1 2 3"  # Optional: 1=left, 2=middle (3-finger), 3=right (2-finger)    
    Option "Tapping" "on"
    Option "TappingButtonMap" "lrm"
    Option "NaturalScrolling" "true"
    Option "ScrollPixelDistance" "20"
EndSection
Each field does the following: - Identifier "touchpad": This config affects touchpads - Driver "libinput": This config uses libinput - MatchIsTouchpad "on": Only apply this to touchpads

/etc/libinput/local-overrides.quirks:

[Magic Trackpad pressure]
MatchUdevType=touchpad
MatchName=*Magic Trackpad
AttrPressureRange=1:0
- MatchUdevType=touchpad This is a touchpad config

For the moment, this is everything.

TODO: - Make the scroll smoother, so it doesn't behave like a mouse scroll that scrolls 3 terminal lines per scroll-unit. It MUST scroll smoothly like in a macOS or an iPhone, and this MUST work in every app opened in order to extremely increase user experience. - Add inertia to the scroll, so it keeps scrolling after you slide up or down for a moment until it stops completely (like in iPhones or a macBook) (stopabble by stepping one or more fingers in the touchpad). I guess we have to wait until the devs are able to port Qubes to Wayland. Anyways I will keep investigating about it. - For some reason, if you try to click and drag something (like moving a window) with a lot of pressure, the cursor will freeze. I'm trying to fix this. You will encounter this issue, at the moment you can try to move windows or select text by applying low pressure to your click or doing so by tapping (will always work) - Add the 3 finger gesture to move between desktops like in macOS

Cool things: