Allow middle mouse button mapping without modifier keys#817
Merged
Caldis merged 1 commit intoCaldis:masterfrom Dec 18, 2025
Merged
Conversation
Previously, the middle mouse button (button 2) was classified as a "main key" alongside left and right clicks, requiring modifier keys (Cmd, Ctrl, etc.) to be held during button mapping. This restriction made it impossible to map the middle button alone to actions like Mission Control. This change removes button 2 from the mouseMainKeys array, allowing users to map their middle mouse button without holding modifiers, while still protecting left (0) and right (1) clicks from accidental remapping. Fixes user workflow where middle button + Mission Control is a common and expected mouse customization pattern.
Owner
|
thanks @GonzFC, I initially set Buttons 1, 2, 3 as mainKeys to prevent users from accidentally binding them and losing their mouse controlls 😂 but it seems that using the middle button for binding operations is also acceptable. |
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
Currently, the middle mouse button (button 2) cannot be mapped to shortcuts without holding modifier keys (Cmd, Ctrl, Option, Shift). When users try to record the middle button alone, the UI shows an orange shake and rejects the input.
This happens because button 2 is classified as a "main key" in
KeyCode.mouseMainKeysalongside left (0) and right (1) clicks, and the validation inCGEvent+Extensions.swiftrequires modifier keys for all main keys.Solution
Remove button 2 from the
mouseMainKeysarray, allowing users to map their middle mouse button without holding modifiers, while still protecting left and right clicks from accidental remapping.Changed:
Use Case
Mapping the middle mouse button to Mission Control (or App Exposé, Show Desktop, etc.) is a very common mouse customization pattern. This is a primary use case mentioned in issue #695 and is supported by other mouse customization tools.
Testing
Related Issues
🤖 Generated with Claude Code