Make Controller Mode shortcuts modifier-based and user-customizable (#235)#242
Open
germanescobar wants to merge 1 commit into
Open
Make Controller Mode shortcuts modifier-based and user-customizable (#235)#242germanescobar wants to merge 1 commit into
germanescobar wants to merge 1 commit into
Conversation
…235) Switch Controller Mode shortcuts from single-letter keys to platform-aware modifier chords so they fire even while the composer has focus: Toggle Controller Mode : Cmd/Ctrl+T Next session : Cmd/Ctrl+N (also commits a pending advance) Mark done : Cmd/Ctrl+D Stay : Cmd/Ctrl+S Blur composer : Esc (unchanged) Add a Settings panel under a new 'Shortcuts' section where each chord can be rebound. Overrides persist to ~/.local/state/Controller/shortcuts.json (or platform equivalent) under shortcutBindingsFile(); only overrides are written so future default changes auto-propagate. Conflict warnings surface for duplicate bindings and reserved OS chords (Cmd+W, Cmd+Q, Cmd+R, etc.). Centralise chord parsing + matching in client/src/lib/shortcut-match.ts and expose bindings via useShortcutBindings() so the renderer, <Kbd> chips in the Controller Mode bar, sidebar tooltip, and Settings UI all read from one place. Plain-letter shortcuts (N / D / F / E / S) no longer fire. Validation: 400/400 tests pass (35 new); vite + server tsc + electron tsc build clean; manual smoke against GET/PUT/DELETE /api/shortcuts confirms the on-disk shape.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #235.
Summary
Switch Controller Mode shortcuts from single-letter keys (N, D, F, E, S) to platform-aware modifier chords so they fire even while the composer has focus. Add a Settings panel where each chord can be rebound; overrides persist to
~/.local/state/Controller/shortcuts.json(or platform equivalent).Defaults
Cmd/Ctrl+TCmd/Ctrl+NCmd/Ctrl+DCmd/Ctrl+SEsc(unchanged)Implementation
shared/shortcuts.tscanonicalises the action list, default chords, and a reserved-chord list (Cmd+W, Cmd+Q, Cmd+R, Ctrl+W, F11, …).server/lib/shortcut-settings.ts+server/routes/shortcuts.tsexposeGET / PUT / DELETE /api/shortcuts. Only overrides are persisted, so future default changes auto-propagate to users who haven't rebinding anything.client/src/lib/shortcut-match.tsparses, matches, formats, and records chords;client/src/lib/useShortcutBindings.tsexposes them via a hook.useControllerModeShortcutsnow reads bindings instead of hard-coded keys; the priority isS→N(commit) →Ttoggle → controller-modeN/D. Plain-letter shortcuts no longer fire.<Kbd>chips in the Controller Mode bar (Next / Done / Exit), the sidebar tooltip, and the new Settings → Shortcuts section all read from the same bindings. The Settings UI supports recording (window-level keydown capture, Esc cancels), saving, restoring defaults, and warns about duplicate / reserved chords.Validation
npm test: 400/400 pass (35 new tests for parser, matcher, recorder, and persisted overrides).npm run build: vite + server tsc + electron tsc all clean.Risk / follow-ups
⇧Enterchord (SessionView.tsx:5639) is left untouched — issue lists it as an open question.handleStayShortcutlistener inSessionView.tsxand the centraluseControllerModeShortcutsboth fire on the stay chord (the local one forstopPropagationdefensiveness). Net effect is correct; can be consolidated later if desired.