Skip to content

Make Apple Magic Trackpad pointer feel closer to macOS - #9276

Open
barmstrong wants to merge 1 commit into
omacom:quattrofrom
barmstrong:fix/apple-magic-trackpad
Open

barmstrong wants to merge 1 commit into
omacom:quattrofrom
barmstrong:fix/apple-magic-trackpad

Conversation

@barmstrong

Copy link
Copy Markdown
Contributor

On Linux, a Magic Trackpad treats a light resting thumb as a second finger. That becomes two-finger scroll or a right-click, and small pointer moves feel jumpy compared with macOS.

Two layers cause it:

  • hid-magicmouse kernel two-finger scroll and 3-button emulation fire as soon as a second contact exists, before libinput can classify it as a thumb.
  • Stock libinput 50-system-apple.quirks sets AttrTouchSizeRange=20:10 on these pads, which turns size-based palm/thumb filtering off.

This change:

  • Installs /etc/libinput/omarchy-magic-trackpad.quirks so a light edge rest is ignored. Harmless on machines without the pad (match is by device name).
  • Writes /etc/modprobe.d/omarchy-magic-trackpad.conf (emulate_scroll_wheel=0, emulate_3button=0) when a Magic Trackpad is present, so libinput owns two-finger scroll and click. Two-finger right-click still works through clickfinger_behavior.
  • Skips those kernel options when an Apple Magic Mouse is also connected. That mouse still needs kernel surface-scroll emulation (same module).
  • Pins Hyprland adaptive accel and sensitivity 0 on the common Magic Trackpad device names, so raising the global pointer speed does not make this large pad jumpy.
  • Migrates existing installs and applies the kernel params live via sysfs when the module is loaded, so a reboot is not required for that half.

Tested on a USB Magic Trackpad 2 (05AC:0265) on Omarchy 4.0.1. Resting-thumb scroll/right-click stopped, and fine text selection became usable.

test/shell.d/magic-trackpad-test.sh covers install and migration for trackpad-only, mouse-present, no-device, and Bluetooth USB-C IDs.

hid-magicmouse treats a resting thumb as a second finger, so a light
edge contact becomes two-finger scroll or a right-click. Stock libinput
also disables size-based palm/thumb filtering on these pads
(TouchSizeRange 20:10). Skip kernel gesture emulation when a Magic
Trackpad is present, re-enable libinput thumb/palm thresholds, and keep
Hyprland's default sensitivity and adaptive accel on the pad even if
the user raises the global pointer speed.

The same kernel module drives Magic Mouse, whose surface-scroll still
needs emulate_scroll_wheel, so those options are skipped when a Magic
Mouse is connected.
@spuder

spuder commented Aug 31, 2026

Copy link
Copy Markdown

Is this only for the usb version? Looking for a fix for the built in trackpad on macbook air that has same symptom.

@barmstrong

Copy link
Copy Markdown
Contributor Author

yes it's only for the USB/bluetooth external magic trackpad

reeseroyster added a commit to reeseroyster/omarchy that referenced this pull request Sep 18, 2026
1788129995.sh collides with six other open PRs (omacom#9276, omacom#9445, omacom#9446,
omacom#9478, omacom#9522, omacom#9562); same filename means the same completion marker,
so only the first merged migration would ever run. Renamed to the
fresh, currently-unused timestamp 1789739221.
@omarchybot omarchybot added the enhancement New feature or request label Oct 3, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 1dbdb9c by Claude Opus 5.5. No second opinion ran: the configured reviewer answers, but omabot's daily review budget was spent, so this is one model's reading plus what ran on a worker. Nothing was pushed, because two of the three layers rest on a premise that does not hold, and that needs rethinking rather than patching.

The libinput quirks file is never read. libinput scans /usr/share/libinput/*.quirks and reads exactly one file from /etc: /etc/libinput/local-overrides.quirks. On a worker (libinput 1.32.0) I created a uinput touchpad identifying as a Magic Trackpad 2 (05AC:0265, "Apple Inc. Magic Trackpad") and ran libinput quirks list on it. With install/hardware/apple/fix-magic-trackpad.sh installed as written, it still reports the stock AttrTouchSizeRange=20:10, AttrThumbSizeThreshold=800, AttrPalmPressureThreshold=190. Moving the identical content to local-overrides.quirks makes it report 40:20, 550, 160 and AttrThumbPressureThreshold=70. Quattro already installs quirks that way (install/hardware/asus/fix-asus-proart-p14-touchpad.sh, migrations/1790917415.sh), and #6388 is the same bug found on another quirk.

The hid_magicmouse options do nothing to a trackpad and only affect a Magic Mouse. In drivers/hid/hid-magicmouse.c, scroll-wheel emulation in magicmouse_emit_touch is explicitly skipped for MAGICTRACKPAD2 and MAGICTRACKPAD2_USBC, and REL_WHEEL/BTN_MIDDLE are only advertised for the three Magic Mouse IDs in magicmouse_setup_input, so the v1 trackpad's wheel events are dropped by the input core anyway. emulate_3button is read only in magicmouse_emit_buttons, which only mice call. scroll_acceleration already defaults to off. Trackpads send raw multitouch and libinput already owns their scrolling and clicking. That makes /etc/modprobe.d/omarchy-magic-trackpad.conf a pure regression risk: the Magic Mouse check only runs at install and migration time, so someone who pairs a Magic Mouse later, or whose Bluetooth mouse was asleep when the migration ran, gets a mouse with no scrolling at all. Nothing on a trackpad improves in exchange.

The Hyprland block does nothing on a stock install. Quattro's default/hypr/input.lua already sets sensitivity = 0 and touchpad.clickfinger_behavior = true, and adaptive is libinput's default profile. The only effect is to override a user who raises global sensitivity, which is a product call for the maintainer. The device name apple-inc.-magic-trackpad does match what Hyprland reported for the fake device, and the block raised no config errors. As the comment in magicmouse_setup_input notes, a trackpad paired over Bluetooth reports its personalised name ("José's Trackpad"). Both MatchName=*Magic Trackpad* and the six Hyprland names miss it. libinput's own quirks match by vendor and product for that reason.

It no longer merges. Quattro already has migrations/1788129995.sh (the Omasnap migration), and omarchy-migrate keys its state by filename. Keeping this file under that name would replace the Omasnap migration, and every existing install would treat it as already run. It needs a fresh timestamp. default/hypr/input.lua also conflicts with quattro's terminal_scroll rewrite, though trivially.

The tests can't catch any of this. test/shell.d/magic-trackpad-test.sh passes (9/9 on a worker, on the head merged with quattro), and ./test/cli is green. But the test only checks that files appear in a temp dir, so it passes even though libinput ignores the file. It also greps input.lua and all.sh for the lines it adds, which AGENTS.md asks tests not to do.

What a proportionate version would look like: drop the modprobe file, the sysfs writes and the two omarchy-hw-apple-magic-* commands. Put the thumb and palm thresholds where libinput reads them, matched by vendor and product (05AC/004C with 0265, 0324, 030E) rather than by name. Leave the Hyprland pin out unless the maintainer wants it. Ship it as a migration with a new timestamp.

Since this is hardware no worker has, whether the new thresholds actually ignore a resting thumb can only be settled on a real Magic Trackpad. The head as committed can't have changed thumb handling through either the quirk or the module options, so the result described in the PR body probably came from a different state on the test machine. A reworked head needs confirmation on that exact commit from a maintainer with a Magic Trackpad. There is no linked issue, and the author's own confirmation doesn't count toward verification here.

Waiting on the author for a rework, and on the maintainer for the sensitivity-pin question.

@omarchybot

Copy link
Copy Markdown
Collaborator

A second opinion has now reviewed 1dbdb9c: Codex Medium and muse-spark-1.3-contributor (via pi, thinking high).

Codex agrees with the findings above: the quirks file is not read, the module options do nothing for Trackpad 2 and break a Magic Mouse connected later, the migration name collides with Omasnap's, the Hyprland block only overrides a user's global settings, and the test passes without testing the effect. It adds two points. First, the Hyprland name list misses apple-inc.-magic-trackpad-2021, which the driver uses for the 2021 Bluetooth model, so that pad gets none of the per-device settings. Second, if an earlier install wrote /etc/modprobe.d/omarchy-magic-trackpad.conf, a later migration still applies the options live even when a Magic Mouse is now connected, because skipping the write does not remove the old file.

One correction to my comment above. I said a trackpad paired over Bluetooth reports its personalised name. Both reviewers point out that hid-magicmouse.c replaces that name with the standard one for the Trackpad 2 and its later models, so *Magic Trackpad* does match them. The personalised-name problem applies only to the first-generation trackpad (030E).

Muse disagreed on one point, saying libinput reads any /etc/libinput/*.quirks file. I am keeping the finding as it stands: on the worker, libinput quirks list with libinput 1.32.0 showed the stock values with this file installed, and the override values once the same content was in local-overrides.quirks, which is the one file libinput's documentation names.

The reviewers read this session's earlier findings, so their agreement is not guaranteed to be independent. Still waiting on a rework from the author and on the maintainer for the sensitivity question.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants