fix(hook): remap aux buttons that arrive without HID attribution on macOS 26 - #733
Open
tims2002 wants to merge 1 commit into
Open
fix(hook): remap aux buttons that arrive without HID attribution on macOS 26#733tims2002 wants to merge 1 commit into
tims2002 wants to merge 1 commit into
Conversation
…acOS 26 macOS 26 delivers other-mouse (aux button) CGEvents with no backing IOHIDEvent: CGEventCopyIOHIDEvent returns null for otherMouseDown/Up, while left-click events from the same physical device still carry a sender that resolves to the expected IOKit service (verified with a listen-only tap on macOS 26.6.2 / arm64: left clicks report Product="USB Receiver", VendorID=0x046d; button-4 events report a null HID event). The hook's fail-closed attribution gate therefore dropped every Middle/Back/Forward press, silently disabling all OS-hook remaps and hold+swipe gestures — while HID++-diverted single-action bindings kept working, which made the breakage look device-specific. Allow an unattributed event through the gate only for the OS-hook buttons (Middle/Back/Forward): built-in trackpads never emit those buttons, so the trackpad-protection rationale for failing closed does not apply to them. Everything else keeps failing closed as before. Tested on macOS 26.6.2 (arm64) with an ERGO M575 over both Bluetooth LE and a Unifying receiver: click remaps and per-direction gestures on Back/Forward/Middle work again; trackpad input is unaffected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Greptile SummaryThe PR restores macOS 26 remapping for auxiliary mouse events that arrive without HID attribution while retaining source checks for attributed events and fail-closed behavior for primary buttons.
Confidence Score: 5/5The PR appears safe to merge, with no concrete blocking or independently actionable issue identified. The relaxed path applies only to Middle, Back, and Forward events lacking device attribution; attributed events retain the existing source validation, and primary buttons remain excluded before remapping.
|
| Filename | Overview |
|---|---|
| crates/openlogi-agent-core/src/hook_runtime.rs | Narrows the macOS missing-attribution exception to the three OS-hook auxiliary buttons without exposing primary-button events to suppression. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Mouse button event] --> B{Middle, Back, or Forward?}
B -- No --> P[Pass through]
B -- Yes --> C{Device attributed?}
C -- Yes --> D{Logitech non-trackpad?}
D -- No --> P
D -- Yes --> R[Resolve configured remap]
C -- No --> E{Running on macOS?}
E -- No --> R
E -- Yes --> R
Reviews (1): Last reviewed commit: "fix(hook): remap aux buttons that arrive..." | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On macOS 26, all OS-hook button remaps and hold+swipe gestures silently stop working, while HID++-diverted single-action bindings keep working. This makes the breakage look device-specific (it isn't) — observed with an ERGO M575 over both Bluetooth LE and a Unifying receiver, and it should affect every device whose Middle/Back/Forward go through the CGEventTap hook.
Root cause
macOS 26 delivers other-mouse (aux button) CGEvents without a backing IOHIDEvent —
CGEventCopyIOHIDEventreturns null — soevent_sender_idyieldsNoneandbutton_source_may_remapfails closed, passing every Middle/Back/Forward press through untouched.Verified with a listen-only diagnostic tap on macOS 26.6.2 (arm64), pressing buttons on the same physical device:
Left clicks still attribute correctly, so the regression is specific to aux-button events in the macOS 26 input pipeline.
Fix
Allow an unattributed event through the gate only for the OS-hook buttons (Middle/Back/Forward). The fail-closed rule exists so the built-in trackpad can never be swallowed — but trackpads never emit those buttons, so that rationale doesn't apply to them. Attributed events keep the existing Logitech/non-trackpad check, and everything else keeps failing closed.
Testing
Possible follow-up (not in this PR)
The M575 (and likely other non-MX devices) reports
divertable, raw-xyon CIDs 0x52/0x53/0x56 (openlogi diag controls), so per-direction gestures for these buttons could be delivered over HID++ raw-XY diversion like the MX gesture button — transport-independent and immune to CGEvent pipeline changes like this one. Happy to file a separate issue if useful.🤖 Generated with Claude Code