feat(keybinding): several shortcuts per action, mouse buttons, searchable picker
Shortcuts were defined in four places that drifted apart: per-action IPC channel pairs, a hand-written VK table in the service, a second one in the renderer, and three copies of the keycap styling. Adding an action meant editing all of them, so two shortcuts stayed hardcoded in bootstrap and one had no settings entry at all. packages/core/src/keybinding.ts is now the single source for the binding type, the selectable key catalog, the action catalog, normalization, validation, conflict detection, display labels, search and deserialization. Main, preload and renderer all read from it; nothing redefines keys or rules locally. - Each action holds a list of bindings instead of one. AppConfig's four *Shortcut fields collapse into a single keyBindings map, migrated on launch. - Mouse buttons can be bound. Left click is refused, right/middle need a modifier, side buttons are free. uiohook cannot swallow events, so the original click still fires and the UI says so. - Keys can be picked from a grouped dropdown with a search box, not only by recording a keypress. - HOTKEY's 14 channels become KEYBINDING's 9, taking the action as a parameter, so actions no longer multiply channels. The history and command popups moved out of bootstrap into ordinary actions. - displayLabel is gone; labels derive from the binding and follow the app language and platform. Fixes found on the way: - Double-press hands-free was unreachable: lookup returned only the first matching action, and dictation shares its default binding. - Reserved-combination checks compared joined key names, so a different modifier order let Ctrl+C through. - Disabling shortcuts released every global registration in the process, including the popup ones, and never restored them. - Enabling shortcuts after starting disabled left nothing registered. - The dashboard stored the caption event payload instead of the state in it.
This commit is contained in:
parent
0ca9e242fa
commit
4ad1ae6ed4
49 changed files with 5901 additions and 1792 deletions
|
|
@ -97,22 +97,30 @@ export const IPC_CHANNELS = {
|
|||
PREMIUM_UPGRADE_REQUIRED: 'llm:premiumUpgradeRequired'
|
||||
},
|
||||
|
||||
HOTKEY: {
|
||||
GET_DICTATION_SHORTCUT: 'hotkey:getDictationShortcut',
|
||||
SET_DICTATION_SHORTCUT: 'hotkey:setDictationShortcut',
|
||||
GET_HANDS_FREE_SHORTCUT: 'hotkey:getHandsFreeShortcut',
|
||||
SET_HANDS_FREE_SHORTCUT: 'hotkey:setHandsFreeShortcut',
|
||||
GET_COMMAND_SHORTCUT: 'hotkey:getCommandShortcut',
|
||||
SET_COMMAND_SHORTCUT: 'hotkey:setCommandShortcut',
|
||||
GET_CAPTION_SHORTCUT: 'hotkey:getCaptionShortcut',
|
||||
SET_CAPTION_SHORTCUT: 'hotkey:setCaptionShortcut',
|
||||
IS_ENABLED: 'hotkey:isEnabled',
|
||||
SET_ENABLED: 'hotkey:setEnabled',
|
||||
START_RECORDING: 'hotkey:startRecording',
|
||||
STOP_RECORDING: 'hotkey:stopRecording',
|
||||
/**
|
||||
* 키바인딩. 액션을 파라미터로 받는 단일 채널 집합이다 —
|
||||
* 액션이 늘어도 채널을 늘리지 않는다. 계약 정본은 `packages/core/src/keybinding.ts`.
|
||||
*/
|
||||
KEYBINDING: {
|
||||
/** 전체 액션의 바인딩 맵 조회 */
|
||||
GET_MAP: 'keybinding:getMap',
|
||||
/** 한 액션의 바인딩 목록 교체 */
|
||||
SET_BINDINGS: 'keybinding:setBindings',
|
||||
/** 한 액션을 기본값으로 되돌림 */
|
||||
RESET_ACTION: 'keybinding:resetAction',
|
||||
/** 전체를 기본값으로 되돌림 */
|
||||
RESET_ALL: 'keybinding:resetAll',
|
||||
/** 바인딩 유효성 + 액션 간 충돌 사전 검사 */
|
||||
VALIDATE: 'keybinding:validate',
|
||||
/** 전역 키바인딩 on/off 조회 */
|
||||
IS_ENABLED: 'keybinding:isEnabled',
|
||||
/** 전역 키바인딩 on/off 설정 */
|
||||
SET_ENABLED: 'keybinding:setEnabled',
|
||||
// Main → Renderer events
|
||||
TRIGGERED: 'hotkey:triggered',
|
||||
RECORDING_RESULT: 'hotkey:recordingResult'
|
||||
/** 바인딩 입력 감지 알림 */
|
||||
TRIGGERED: 'keybinding:triggered',
|
||||
/** 바인딩 맵 변경 알림 (창 간 동기화) */
|
||||
CHANGED: 'keybinding:changed'
|
||||
},
|
||||
|
||||
CONFIG: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue