Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save peterychuang/5cf9bf527bc26adef47d714c758a5509 to your computer and use it in GitHub Desktop.
Save peterychuang/5cf9bf527bc26adef47d714c758a5509 to your computer and use it in GitHub Desktop.
Enable touch-size-based palm rejection and disable touchpad while typing for Apple SPI Keyboard and Touchpad under libinput
From a3febd1a49f259049d0d9650e297590b56d71ae4 Mon Sep 17 00:00:00 2001
From: "Peter Y. Chuang" <peteryuchuang@gmail.com>
Date: Fri, 4 Aug 2017 00:24:36 +0200
Subject: [PATCH libinput] udev: Add Apple SPI Keyboard and Touchpad
This enables touch-size-based palm rejection and disable-while-typing
touchpad feature for the SPI keyboards and touchpads inside the 12-inch
MacBooks and 2016 or later MacBook Pros.
---
udev/90-libinput-model-quirks.hwdb | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb
index 2754c5d5..936cb67f 100644
--- a/udev/90-libinput-model-quirks.hwdb
+++ b/udev/90-libinput-model-quirks.hwdb
@@ -56,6 +56,14 @@ libinput:touchpad:input:b0005v05ACp*
libinput:name:*Apple Inc. Apple Internal Keyboard*:dmi:*
LIBINPUT_ATTR_KEYBOARD_INTEGRATION=internal
+libinput:name:*Apple SPI Touchpad*:dmi:*
+ LIBINPUT_MODEL_APPLE_TOUCHPAD=1
+ LIBINPUT_ATTR_TOUCH_SIZE_RANGE=50:30
+ LIBINPUT_ATTR_PALM_SIZE_THRESHOLD=800
+
+libinput:name:*Apple SPI Keyboard*:dmi:*
+ LIBINPUT_ATTR_KEYBOARD_INTEGRATION=internal
+
libinput:mouse:input:b0005v05ACp030D*
LIBINPUT_MODEL_APPLE_MAGICMOUSE=1
--
2.13.4
@dar5hak
Copy link

dar5hak commented Dec 5, 2020

Hmm, I did it on 4.15. Things likely changed from the kernel side.

@lilyinstarlight
Copy link

It looks like you don't need to recompile libinput to add a few custom hardware quirks (see https://wayland.freedesktop.org/libinput/doc/latest/device-quirks.html#installing-temporary-local-device-quirks and the next section for debugging quirks).

There's a newer local-overrides.quirks file at https://gist.github.com/roadrunner2/1289542a748d9a104e7baec6a92f9cd7#file-local-overrides-quirks for the Apple SPI driver (and touch bar driver which isn't in the mainline kernel) that it seems can just be copied to /etc/libinput/local-overrides.quirks and use your distribution's libinput.

I hope that helps! I don't run Linux bare metal on my Macbook any more for a variety of reasons or I would let you know if copying that file worked for me.

@jaxjexjox
Copy link

jaxjexjox commented Dec 24, 2020

I apologise for having someone so low skilled reply here, but I don't suppose what I need to do, to get this working? Simply write a file to a path, that the OS will parse on boot?

I'm running Ubuntu 20.10, I'd give myself about a 3.5/10 to a 4 on the linux competency scale at best.
Macbook 13,1 (A1708)

NOTE: specifically the disabling of the touchpad on typing, I've not got a touchbar, but using this is a bit fiddly when the touchpad picks up my thumbs here and there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment