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": "Busca y gestiona transcripciones de grabaciones e importaciones.",
"mobile.meetings.templateEmpty": "No hay plantillas de documento de reunión disponibles. Puedes iniciar la reunión sin una.",
"mobile.meetings.templateNone": "Empezar sin plantilla",
"mobile.meetings.templateNoneDesc": "Elige una plantilla al generar documentos"
"mobile.meetings.templateNoneDesc": "Elige una plantilla al generar documentos",
"keybinding.mouse.left": "Botón izquierdo del ratón",
"keybinding.mouse.right": "Botón derecho del ratón",
"keybinding.mouse.middle": "Botón central del ratón",
"keybinding.mouse.back": "Botón Atrás del ratón",
"keybinding.mouse.forward": "Botón Adelante del ratón",
"keybinding.group.mouse": "Ratón",
"keybinding.group.modifier": "Modificadores",
"keybinding.group.function": "Teclas de función",
"keybinding.group.letter": "Letras",
"keybinding.group.digit": "Números",
"keybinding.group.numpad": "Teclado numérico",
"keybinding.group.navigation": "Navegación",
"keybinding.group.editing": "Edición",
"keybinding.group.punctuation": "Símbolos",
"keybinding.group.system": "Sistema",
"keybinding.action.dictation": "Dictado",
"keybinding.action.dictation.desc": "Graba mientras se mantiene pulsada la tecla.",
"keybinding.action.handsFree": "Modo un toque",
"keybinding.action.handsFree.desc": "Pulsa dos veces para activarlo o desactivarlo.",
"keybinding.action.command": "Comandos de voz",
"keybinding.action.command.desc": "Ejecuta un comando por voz.",
"keybinding.action.caption": "Subtítulos en directo",
"keybinding.action.caption.desc": "Activa o desactiva los subtítulos en directo.",
"keybinding.action.historyPopup": "Ventana de historial",
"keybinding.action.historyPopup.desc": "Abre la ventana emergente del historial.",
"keybinding.action.commandPopup": "Ventana de comandos",
"keybinding.action.commandPopup.desc": "Abre la ventana emergente de comandos.",
"keybinding.reject.unknownKey": "Esta tecla no es compatible",
"keybinding.reject.systemReserved": "Es un atajo reservado por el sistema",
"keybinding.reject.modifierRequired": "Debe combinarse con un modificador (Ctrl/Alt/Mayús)",
"keybinding.disabled.mouseLeft": "El clic izquierdo se usa en toda la interfaz, así que no se puede asignar",
"keybinding.warning.mousePassthrough": "Los botones del ratón siguen ejecutando también su acción original",
"keybinding.ui.add": "Añadir",
"keybinding.ui.remove": "Eliminar",
"keybinding.ui.reset": "Restablecer valores",
"keybinding.ui.tabRecord": "Pulsar tecla",
"keybinding.ui.tabList": "Elegir de la lista",
"keybinding.ui.search": "Buscar teclas",
"keybinding.ui.searchEmpty": "No hay resultados",
"keybinding.ui.pressKeys": "Pulsa la tecla o el botón del ratón que quieras",
"keybinding.ui.noBindings": "Sin atajo configurado",
"keybinding.ui.conflictWith": "Entra en conflicto con {{action}}",
"keybinding.ui.modifiers": "Modificadores",
"keybinding.ui.selectedKey": "Tecla seleccionada",
"keybinding.ui.sectionVoice": "Voz",
"keybinding.ui.sectionWindow": "Ventanas / Emergentes",
"keybinding.ui.duplicate": "Este atajo ya está añadido",
"keybinding.ui.holdMode": "Mantener",
"keybinding.ui.doublePress": "Doble pulsación",
"keybinding.ui.pickerTitle": "Configurar atajo",
"keybinding.ui.pressToRecord": "Pulsa para empezar a grabar",
"keybinding.ui.recordHint": "Introduce una combinación (ej: Ctrl+Shift+Q) o una tecla sola (ej: F5)",
"keybinding.ui.recordAgain": "Volver a introducir",
"keybinding.ui.saveFailed": "No se ha podido guardar el atajo",
"keybinding.ui.globalEnabled": "Usar atajos globales"
}