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:
Yun Chan 2026-09-21 13:41:47 +09:00
parent 0ca9e242fa
commit 4ad1ae6ed4
49 changed files with 5901 additions and 1792 deletions

View file

@ -270,5 +270,60 @@
"mobile.works.historyDescription": "録音とインポートの文字起こしを検索・管理します。",
"mobile.meetings.templateEmpty": "利用可能な会議ドキュメントテンプレートがありません。テンプレートなしで会議を開始できます。",
"mobile.meetings.templateNone": "テンプレートなしで開始",
"mobile.meetings.templateNoneDesc": "ドキュメント生成時にテンプレートを選択します"
"mobile.meetings.templateNoneDesc": "ドキュメント生成時にテンプレートを選択します",
"keybinding.mouse.left": "マウス左ボタン",
"keybinding.mouse.right": "マウス右ボタン",
"keybinding.mouse.middle": "マウス中ボタン",
"keybinding.mouse.back": "マウス戻るボタン",
"keybinding.mouse.forward": "マウス進むボタン",
"keybinding.group.mouse": "マウス",
"keybinding.group.modifier": "修飾キー",
"keybinding.group.function": "ファンクションキー",
"keybinding.group.letter": "文字",
"keybinding.group.digit": "数字",
"keybinding.group.numpad": "テンキー",
"keybinding.group.navigation": "ナビゲーション",
"keybinding.group.editing": "編集",
"keybinding.group.punctuation": "記号",
"keybinding.group.system": "システム",
"keybinding.action.dictation": "ディクテーション",
"keybinding.action.dictation.desc": "押している間、録音します。",
"keybinding.action.handsFree": "ワンタッチモード",
"keybinding.action.handsFree.desc": "2回押して切り替えます。",
"keybinding.action.command": "音声コマンド",
"keybinding.action.command.desc": "音声でコマンドを実行します。",
"keybinding.action.caption": "リアルタイム字幕",
"keybinding.action.caption.desc": "リアルタイム字幕をオン・オフします。",
"keybinding.action.historyPopup": "履歴ポップアップ",
"keybinding.action.historyPopup.desc": "履歴ポップアップを開きます。",
"keybinding.action.commandPopup": "コマンドポップアップ",
"keybinding.action.commandPopup.desc": "コマンドポップアップを開きます。",
"keybinding.reject.unknownKey": "サポートされていないキーです",
"keybinding.reject.systemReserved": "システム予約のショートカットです",
"keybinding.reject.modifierRequired": "修飾キー(Ctrl/Alt/Shift)と組み合わせて使用してください",
"keybinding.disabled.mouseLeft": "左クリックはすべての画面操作に使われるため、割り当てできません",
"keybinding.warning.mousePassthrough": "マウスボタンは本来の動作も同時に実行されます",
"keybinding.ui.add": "追加",
"keybinding.ui.remove": "削除",
"keybinding.ui.reset": "既定値に戻す",
"keybinding.ui.tabRecord": "直接入力",
"keybinding.ui.tabList": "一覧から選択",
"keybinding.ui.search": "キーを検索",
"keybinding.ui.searchEmpty": "検索結果がありません",
"keybinding.ui.pressKeys": "使用するキーまたはマウスボタンを押してください",
"keybinding.ui.noBindings": "ショートカット未設定",
"keybinding.ui.conflictWith": "{{action}}と重複しています",
"keybinding.ui.modifiers": "修飾キー",
"keybinding.ui.selectedKey": "選択したキー",
"keybinding.ui.sectionVoice": "音声",
"keybinding.ui.sectionWindow": "ウィンドウ / ポップアップ",
"keybinding.ui.duplicate": "すでに追加されているショートカットです",
"keybinding.ui.holdMode": "長押し",
"keybinding.ui.doublePress": "2回押し",
"keybinding.ui.pickerTitle": "ショートカット設定",
"keybinding.ui.pressToRecord": "押して録音開始",
"keybinding.ui.recordHint": "組み合わせキー(例: Ctrl+Shift+Q)または単一キー(例: F5)を入力してください",
"keybinding.ui.recordAgain": "再入力",
"keybinding.ui.saveFailed": "ショートカットを保存できませんでした",
"keybinding.ui.globalEnabled": "グローバルショートカットを使用"
}