feat(hotkey): 支持左右修饰键与鼠标触发听写#724
Closed
HKLHaoBin wants to merge 4 commits into
Closed
Conversation
• 引入了由鼠标中键和侧键触发听写的新用户偏好设置。 • 更新了 UserPreferences 和 UserPreferencesWire 结构体,以包含鼠标按键听写设置。 • 增强了 ShortcutRecorder 组件,支持区分左右侧的修饰键,并增加了单键快捷键预设。 • 更新了英文、日文、韩文、简体中文和繁体中文的新功能翻译。 • 改进了热键处理逻辑,增加了对 Command、Shift 和 Control 键左右变体的支持。 • 为新的热键功能和侧边修饰键添加了单元测试。
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
jiangmuran
requested changes
Jun 21, 2026
jiangmuran
left a comment
Collaborator
There was a problem hiding this comment.
请在提交AI Slop前至少先在本地进行完整实机测试。
Collaborator
|
感谢这块工作,方向是对的(修 #718,CI 全绿、也带了测试)。不过这个 PR 先关闭一下 🙏 原因:体量过大 —— 2788 行改动、38 个文件,单个 PR 很难做到安全、彻底的审查与回归;而且目前还挂着一条未解决的 CHANGES_REQUESTED。 建议拆成几个互相独立、各自可审查可回滚的小 PR,例如:
每块单独提交后会好审很多,欢迎拆分后重新发 PR。关闭不代表否定这个方向,只是当前体量和就绪度的问题。 |
Contributor
Author
|
按审查意见拆成 3 个可独立审查、可回滚的小 PR:
各 PR 的 Test plan 已列出实机验证项,回应 @jiangmuran 的 CHANGES_REQUESTED。原单体分支仍保留在 fork 的 \origin/feat/input-trigger-enhancement\。 |
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.
User description
摘要
Fixes #718
桌面端听写触发增强:听写 start/stop 支持左右侧修饰键组合(含 Fn 等单键预设)、鼠标中键/侧键独立开关、Linux evdev 输入层与 Hold 多触发源 refcount;非听写全局快捷键仍走原有 global-hotkey 路径,并拒绝侧向修饰键绑定。
修复 / 新增 / 改进
SideAwareComboMonitor+side_aware_combo状态机;Win/macOS 物理键监听,Linux 走 evdev;ShortcutRecorder默认录制 generic 修饰键,听写入口启用sideSpecificModifiersHoldSourceTracker多源 Hold refcountrefresh_linux_evdev_monitor,避免 side_combo / 鼠标开关切换后配置残留bindings_overlap按物理修饰键类比较(Windows 上cmd-left与super冲突、与cmd/Ctrl 不冲突);QA/翻译/切风格/打开应用/Less Computer 拒绝侧向组合hotkeySideModifiers.test.ts;Rust 单测覆盖 overlap、macOS keycode、evdev 配置、Windows Shift 侧向组合 dispatch兼容
/dev/input读权限(input 组)测试计划
npm run check:hotkey-side-modifiers、npm run build;cargo metadata(desktop +aarch64-linux-android)npm run build+cargo tauri build(或合并后在 release workflow 产物上验证)Android APK (debug)workflow 于本分支,确认 stub 链路仍通过cmd-left+D/Left Command单键 / 鼠标中键 Hold-Toggleshift-left+D侧向听写;QA 快捷键录制应为super+D而非误存cmd+Dcmd-left+D与super+D应提示冲突;与ctrl+D不应冲突PR Type
Enhancement, Tests
Description
Support left/right modifier keys in dictation hotkey (Cmd, Shift, Ctrl, Alt, Fn)
Add independent mouse middle/side button dictation triggers
Implement Linux evdev input layer for side/combo and mouse events
Refcount multiple hold sources for Hold mode dictation
Diagram Walkthrough
File Walkthrough
14 files
Side-specific modifier matching for dictation hotkeysLinux evdev input for side modifiers and mouse buttonsIntegrate side-aware combo, mouse dictation, Linux evdev loopsAdd new monitors and hold source tracker to CoordinatorAdd side modifier validation, overlap detection, normalizationExtend macOS/Windows hooks to dispatch side and mouse eventsGlobal mouse middle/side button dictation monitorReject side-specific modifiers for non-dictation shortcutsAdd new preferences and HotkeyTrigger variantsUpdate pressed/released edge handling for multi-source holdRefcount multiple dictation trigger sources for Hold modeAdd refresh_mouse_dictation to settings persistenceMap new HotkeyTriggers to Linux key symbolsAdd new modules and start mouse dictation listener4 files
Stub new functions for mobile buildsStub side-aware combo for mobileStub mouse dictation for mobileStub Linux evdev input for mobile3 files
Include side_aware_combo module in test harnessFrontend tests for side modifier hotkey recordingAdd new mouse dictation prefs to test data16 files