feat(hotkey): side-specific modifier combos for dictation (split from #724)#726
feat(hotkey): side-specific modifier combos for dictation (split from #724)#726HKLHaoBin wants to merge 2 commits into
Conversation
Split from Open-Less#724: Win/macOS side-aware bindings (cmd-left+D, Left Command, etc.) with ShortcutRecorder.sideSpecificModifiers, overlap detection, and QA rejection. Linux side combos deferred to follow-up PR3 (evdev). Fixes Open-Less#718 (partial: desktop side modifiers). Co-authored-by: Cursor <cursoragent@cursor.com>
PR Reviewer Guide 🔍(Review updated until commit ae8f38b)Here are some key observations to aid the review process:
|
|
稍等,我处理一下ci问题。 |
Felix201209
left a comment
There was a problem hiding this comment.
按 maintainer 要求从 #724 拆出来的 part 1/3,拆得很干净,approve ✅
经过逐行审查(含状态机锁序、平台 cfg gating、测试矩阵):
- 无阻断问题:
SideAwareComboMonitor状态机锁序安全;mobile / Linux 的编译 gating 正确(mobile_stubs/side_aware_combo.rs、shortcut_binding.rs与真实 API 对齐);overlap 检测逻辑与测试矩阵吻合。 - scope 干净:只含 side-modifier 相关改动,没夹带无关内容。
- 测试到位:
side_aware_combo单测、shortcut_binding/commands/hotkeysoverlap 与拒绝矩阵、前端hotkeySideModifiers.test.ts、Windows 集成测试都覆盖了。 - 五项 CI 全绿(Android / Linux / Windows / macOS / pr_agent)。
几个不阻断的小点,留作后续即可,不拦合并:
- side combo 事件分发处有个极小的 TOCTOU——切换绑定的瞬间理论上可能向新 binding 投递一个多余
Pressed,不崩、combo_active基本能吸收。 comboOnly模式下按单个修饰键不再弹comboNeedKey提示,算轻微 UX 回退,建议补回。check:hotkey-side-modifiers用了npx tsx,与其它node scripts/*不一致,建议统一或把tsx加进 devDependency。
合并后注意:#727 / #728 与本 PR 在 types.ts 和 5 个语言文件上有重叠新增(leftCommand/leftShift/rightShift),它们需要 rebase 去重。
|
交接说明 📌 本 PR 已审查完成、approve,四平台 CI 全绿,无阻断问题(细节见上方 review)。 合并这一步我做不了:beta 的 (#727 有个会导致听写卡死的 HIGH bug、#728 需要在 #726/#727 之后 rebase 瘦身,均已在各自 PR 说明,先不要合。) |
|
Persistent review updated to latest commit ae8f38b |
User description
摘要
Fixes #718(部分:桌面侧向修饰键)。
由已关闭的 #724 拆分而来(第 1/3 部分):Win/macOS 侧向组合听写(
cmd-left+D、单键Left Command/Fn等),SideAwareComboMonitor+ShortcutRecorder.sideSpecificModifiers;非听写快捷键拒绝侧向修饰键;冲突检测按物理修饰键类。Linux 侧向组合在 PR3(evdev)补齐。关联:#718、#724(Felix 拆分建议)。
修复 / 新增 / 改进
side_aware_combo模块与 Win/macOS 低层 hooksideSpecificModifiers兼容
测试计划
本地实机验证(回应 @jiangmuran CHANGES_REQUESTED):
cmd-left+DHold/Toggle;单键Left Command;keycode 表(T/B/=/0)shift-left+D;录制Meta→super(非cmd)cmd-left+Dvssuper+D(Win)/cmd+D(mac)提示正确npm run check:hotkey-side-modifiers+npm run build请维护者:下载/构建 CI 产物在真机 spot-check;有问题可直接在本 PR 评论。
PR Type
Enhancement, Tests
Description
Add side-aware combo detection for dictation (Win/macOS)
Enhance ShortcutRecorder with sideSpecificModifiers and modifier presets
Reject side-specific modifiers for non-dictation shortcuts
Add binding overlap detection based on physical modifier class
Diagram Walkthrough
File Walkthrough
2 files
Add side_aware_combo and combo_hotkey test modulesTest side modifier functionality16 files
Derive PartialEq, Eq for ComboHotkeyEventAdd side modifier rejection and overlap detectionReject side-specific modifiers for QA hotkeyIntegrate side_aware_combo monitor into coordinatorAdd side-aware combo supervisor and bridge loopHook macOS KEY_UP and Windows dispatch to side_aware_comboRegister side_aware_combo moduleAdd new HotkeyTrigger key mappingsImplement side-specific modifier validation and overlapImplement side-aware combo state machine and platform hooksAdd LeftCommand, LeftShift, RightShift variantsSupport side-specific modifier recording and presetsAdd side-specific modifier helper functionsAdd new HotkeyTrigger typesPass side-specific props to ShortcutRecorderPass side-specific props to ShortcutRecorder2 files
Add stub functions for side modifiersAdd mobile stub for side_aware_combo1 files