name: fantasia-keybinds description: >- Global keyboard shortcuts (faKeybinds): renderer matching, Pinia store, main-process persistence over IPC, and Keybind settings UI. Use when adding or changing app-wide shortcuts, capture validation, or bridge APIs for keybind storage.
Fantasia Archive — global keyboard shortcuts (faKeybinds)
What exists today
- Renderer
keydownlistener (capture) — calls dialog/app helpers without widening preload beyondgetKeybinds/setKeybinds - Definitions:
faKeybindCommandDefinitions.ts(FA_KEYBIND_COMMAND_DEFINITIONS) - Chord logic:
faKeybindsChordFromEvent.ts,faKeybindsChordEqualityAndResolve.ts,faKeybindsChordDisplayAndConflict.ts - UI formatting:
faKeybindsChordUiFormatting.ts— settings, menus, shortcut copy - Dispatch:
faKeybindsGlobalDispatch.ts→faKeybindRunCommand.ts→runFaActionviaFA_KEYBIND_COMMAND_TO_ACTION_ID(fantasia-action-manager) - Layout:
MainLayout.vueregisters afterrefreshKeybinds(); skipped in Storybook canvas + non-Electron - Chromium Ctrl+Shift suppress: main
registerFaChromiumCtrlShiftShortcutSuppress(takesBrowserWindow) →createFaChromiumCtrlShiftGlobalShortcutForwardController(activate/deactivate);globalShortcutaccelerators register only while main window focused (activate onfocus, release onblur+ teardown on close) so backgrounded app never intercepts chords in other apps.before-input-eventalready focus-scoped. BootfaChromiumForwardedKeyChord - Pinia:
S_FaKeybinds.ts - Persistence:
src-electron/mainScripts/keybinds/;registerFaKeybindsIpc.ts;FA_KEYBINDS_IPC - Preload:
faKeybindsAPI.ts; typestypes/I_faKeybindsDomain.ts - Settings UI:
DialogKeybindSettings/— table from definitions; capture indialogKeybindSettingsCapture*.ts - Shipped:
openProjectSettings→openProjectSettingsDialogwhen active project
src/scripts/keybinds/ — avoid fragmentation
Few domain modules: chord parse, equality/resolve, display/conflict, dispatch wiring. faKeybindRunCommand.ts stays thin for vi.mock seam — typescript-scripts.mdc.
Adding a new global command (checklist)
types/I_faKeybindsDomain.ts— appendFA_KEYBIND_COMMAND_IDSfaKeybindCommandDefinitions.ts— one definition rowi18n/*/dialogs/L_dialogKeybindSettings.ts—commands.<camelCaseId>faKeybindRunCommand.ts—FA_KEYBIND_COMMAND_TO_ACTION_IDrow; register action infaActionDefinitions.ts- Tests — run command, dispatch integration, definitions, store, dialog, Electron IPC/preload
Persisted schema changes → Zod in src-electron/shared/ + keybinds_manager + bridge sync.
Playwright (keyboard.press)
Use faPlaywrightKeyboardChords.ts — primary vs literal Control per faKeybindExpandDefaultChord. Docs: playwright-tests.mdc, fantasia-testing.
Related
- fantasia-action-manager, fantasia-electron-preload, fantasia-electron-main, fantasia-quasar-vue, fantasia-i18n
Types
Shared types → types/. See types-folder.mdc.