feat(macos): implement mouse button input and side button output support#2005
Merged
jtroo merged 1 commit intojtroo:mainfrom Apr 8, 2026
Merged
feat(macos): implement mouse button input and side button output support#2005jtroo merged 1 commit intojtroo:mainfrom
jtroo merged 1 commit intojtroo:mainfrom
Conversation
Enable mouse buttons (mlft, mrgt, mmid, mbck, mfwd) in defsrc on macOS by adding a CGEventTap that intercepts and remaps mouse button events. The tap only installs if the config maps mouse buttons Fix mbck and mfwd output actions which previously panicked on macOS Requires Accessibility or Input Monitoring permission on macOS Update docs/config.adoc, platform-known-issues.adoc, and release-template.md to reflect macOS mouse support
18077b8 to
2953ff4
Compare
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.
Partially addresses #1470 (mapping mouse buttons on macOS)
Describe your changes. Use imperative present tense
Add mouse button input interception and side button (forward/backward) output
support on macOS
Mouse button output (side buttons)
Fix
mbckandmfwdactions which currently panic on macOS because the codedoes not know which
CGEventTypeto use for side buttonsUse
CGEventType::OtherMouseDown/Up(same event type as middle click) andoverride the
MOUSE_EVENT_BUTTON_NUMBERfield to the correct button index (3for Back, 4 for Forward). The Rust
core-graphicscrate'sCGMouseButtonenumonly has 3 variants but the underlying Apple API supports up to 32 buttons via
this field
Ref: init(mouseEventSource:mouseType:mouseCursorPosition:mouseButton:), setIntegerValueField
Mouse button input (event tap)
Before this change, mouse buttons in
defsrchad no effect on macOS because theKarabiner DriverKit only captures keyboard HID events
Add a
CGEventTapon a background thread that intercepts mouse buttonevents at the HID level. Suppress mapped buttons and forward them to kanata's
processing channel for remapping; pass unmapped buttons through. Follow the same
architecture as the Windows mouse hook (
src/kanata/windows/llhook.rs). Onlyinstall the tap if the config has mouse buttons in
defsrcRequire Accessibility or Input Monitoring permission in System Settings >
Privacy & Security
Checklist