feat: Add mouse gesture feature#974
Open
xtxo wants to merge 1 commit into
Open
Conversation
…er keyboard shortcuts - Add MouseGestureTracker to track mouse movement while holding right button - Support 8 directions (up, down, left, right, and 4 diagonals) - Default gestures: - Up-Left: ESC key - Up: Cmd+R (Refresh) - Minimum distance threshold (30px) to prevent accidental triggers - Integrates with existing ButtonCore event tap system
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.
Summary
This PR adds a mouse gesture feature to Mos, allowing users to trigger keyboard shortcuts by holding the right mouse button and moving in specific directions.
Motivation / Why This Feature
使用场景:
很多用户习惯用鼠标右键长按来触发 ESC 键(比如关闭弹窗、退出全屏、取消操作等)。但现有的 Mos 功能只能绑定单个按键,无法实现"按住右键 + 移动方向"这种更直观的手势操作。
痛点:
解决方案:
通过鼠标手势,用户可以:
这样更符合直觉,也更高效。未来可以扩展更多方向和功能。
Changes
Mos/ButtonCore/MouseGestureTracker.swift- Core gesture tracking logicMos/ButtonCore/ButtonCore.swift- Integration with existing event tap systemFeature Details
How it works
Default gestures
Technical implementation
CGEventTapto monitor mouse movement while right button is heldButtonCoreandInputProcessorarchitectureTesting
Notes
This is a basic implementation. Future enhancements could include: