Files
openless/openless-all/app/src
baiqing b1a07a4c66 fix(hotkey): macOS 上 Alt/Meta 键标签显示 Option/Cmd 而非 Alt/Win
QA 浮窗(划词追问触发的浮窗)一直在显示 "右Alt" 而不是用户实际按的
"右 Option"。

根因:QaPanel.tsx 用 getHotkeyBindingLabel(prefs.hotkey) → 走
getHotkeyBindingCodes → 把 trigger="rightOption" 通过 legacyTriggerCode
映射成键盘事件 code "AltRight" → getHotkeyCodeLabel("AltRight")
**平台无关**地返回 "右Alt" / "Right Alt"。

而 SelectionAsk 页用 formatComboLabel(prefs.dictationHotkey)(primary
"RightOption" → formatPrimary 走 "rightoption" 分支 → "Right ⌥"),
所以 SelectionAsk 页面是对的,QA 浮窗就显示成了 "Alt"。

同样的平台错配在 MetaLeft / MetaRight:之前一律显示 "Win",macOS
应该是 "Cmd / ⌘";OSLeft / OSRight 同样修复。

修复 getHotkeyCodeLabel:按 currentPlatform().isMac 分流:
- AltLeft  → macOS "左 ⌥" / "Left ⌥",其它 "左Alt" / "Left Alt"
- AltRight → macOS "右 ⌥" / "Right ⌥",其它 "右Alt" / "Right Alt"
- MetaLeft / OSLeft   → macOS "左 ⌘" / "Left ⌘"
- MetaRight / OSRight → macOS "右 ⌘" / "Right ⌘"
- Linux/Windows 路径不变

⌥/⌘ 与 formatPrimary 的输出格式一致,全 app hotkey 标签平台一致。
2026-05-07 16:33:29 +08:00
..