Skip to content

Make Controller Mode shortcuts modifier-based and user-customizable (#235)#242

Open
germanescobar wants to merge 1 commit into
mainfrom
issue-235
Open

Make Controller Mode shortcuts modifier-based and user-customizable (#235)#242
germanescobar wants to merge 1 commit into
mainfrom
issue-235

Conversation

@germanescobar

Copy link
Copy Markdown
Owner

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

Action Chord
Toggle Controller Mode Cmd/Ctrl+T
Next session (also commits a pending advance) Cmd/Ctrl+N
Mark done Cmd/Ctrl+D
Stay (cancel pending advance) Cmd/Ctrl+S
Blur composer Esc (unchanged)

Implementation

  • New shared/shortcuts.ts canonicalises the action list, default chords, and a reserved-chord list (Cmd+W, Cmd+Q, Cmd+R, Ctrl+W, F11, …).
  • Server: server/lib/shortcut-settings.ts + server/routes/shortcuts.ts expose GET / PUT / DELETE /api/shortcuts. Only overrides are persisted, so future default changes auto-propagate to users who haven't rebinding anything.
  • Client: client/src/lib/shortcut-match.ts parses, matches, formats, and records chords; client/src/lib/useShortcutBindings.ts exposes them via a hook. useControllerModeShortcuts now reads bindings instead of hard-coded keys; the priority is SN (commit) → T toggle → controller-mode N/D. Plain-letter shortcuts no longer fire.
  • UI: <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.
  • Manual smoke against the running server confirmed GET/PUT/DELETE round-trips and that the on-disk file contains only the diff against defaults.

Risk / follow-ups

  • The skill picker's ⇧Enter chord (SessionView.tsx:5639) is left untouched — issue lists it as an open question.
  • The local handleStayShortcut listener in SessionView.tsx and the central useControllerModeShortcuts both fire on the stay chord (the local one for stopPropagation defensiveness). Net effect is correct; can be consolidated later if desired.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make Controller Mode shortcuts modifier-based and user-customizable

1 participant