Repository navigation
Add gesture button feature (similar to Logitech MX Master's Gesture button) - #1046
Conversation
Implement a configurable gesture button that allows users to press and hold a button (default: middle/scroll wheel) and drag the mouse to trigger macOS gestures. This provides MX Master-like gesture functionality.
|
Thanks for the PR! Just saw it — I’ll pull and test soon. |
There was a problem hiding this comment.
Pull request overview
This PR adds a gesture button feature similar to Logitech MX Master 3's gesture button, allowing users to hold a mouse button (currently middle button/scroll wheel) while dragging to trigger macOS gestures like Mission Control, space switching, and more.
Key Changes
- New gesture button UI in ButtonsSettings with configurable threshold and directional swipe actions
- State machine-based event transformer to track button press, drag, and gesture detection
- Auto-hides for trackpad devices (mouse-only feature)
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| GestureButtonSection.swift | New UI component for gesture button configuration with toggle, button picker, threshold slider, and action pickers |
| GestureActionPicker.swift | Reusable picker component for selecting gesture actions (Mission Control, App Exposé, etc.) |
| ButtonsSettingsState.swift | Adds computed properties for gesture configuration state management with defaults |
| Gesture.swift | New data model defining gesture configuration structure and available actions |
| Buttons.swift | Integrates gesture configuration into buttons schema with merge logic |
| GestureButtonTransformer.swift | Core event transformer with state machine for gesture detection and execution |
| EventTransformerManager.swift | Integrates GestureButtonTransformer into the event transformation pipeline |
| Configuration.d.ts | TypeScript documentation for gesture configuration schema |
| Localizable.xcstrings | Localization entries for new UI strings |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Check for timeout (3 seconds) | ||
| let elapsed = DispatchTime.now().uptimeNanoseconds - startTime | ||
| if elapsed > 3_000_000_000 { |
There was a problem hiding this comment.
Magic number for timeout. The timeout value of 3_000_000_000 nanoseconds (3 seconds) is hardcoded in the gesture tracking logic. Consider extracting this as a named constant (e.g., private let gestureTimeoutNanos: UInt64 = 3_000_000_000) or making it configurable through the Gesture configuration to improve maintainability and allow users to adjust the timeout if needed.
| state = .triggered | ||
|
|
||
| // Enter cooldown | ||
| let cooldownNanos = UInt64(cooldownMs) * 1_000_000 | ||
| state = .cooldown(until: DispatchTime.now().uptimeNanoseconds + cooldownNanos) |
There was a problem hiding this comment.
The state is being set twice in the gesture trigger flow. Line 148 sets the state to .triggered, then immediately on line 152, it's overwritten to .cooldown. The .triggered state assignment is redundant and should be removed since the cooldown state should be set directly after executing the gesture.
| deadZone: Double(gesture.deadZone ?? 40), | ||
| cooldownMs: gesture.cooldownMs ?? 500, |
There was a problem hiding this comment.
The deadZone and cooldownMs parameters are hardcoded in the EventTransformerManager (lines 170, 171) with default values of 40 and 500 respectively, but these configuration options are defined in the Gesture model and documented in Configuration.d.ts. Consider adding UI controls for these parameters in GestureButtonSection, or if they're intentionally hidden from the UI, add a comment explaining why these advanced parameters are not exposed to users.
Co-authored-by: Copilot <[email protected]>
|
Thanks! |
Adds a gesture button feature similar to Logitech MX Master 3's gesture button. Users can hold a mouse button (only scroll wheel implemented) while dragging to trigger macOS gestures like Mission Control, space switching, etc.
Changes
Testing
Thanks for maintaining this project!