Skip to content

feat: add layered keybindings with help and key hints - #1

Merged
autoantohaki merged 1 commit into
mainfrom
feat/keybindings
Oct 21, 2026
Merged

autoantohaki merged 1 commit into
mainfrom
feat/keybindings

Conversation

@autoantohaki

Copy link
Copy Markdown
Member

Requested by mau

Before: a Relay Shell application had to read the keyboard with Ink's useInput in every component, so two components could react to the same key and there was no way to list what the keys do.

After: KeymapProvider reads the keyboard once and routes each key to one binding. Components declare keys with useKeybindings, ? opens a grouped keyboard reference (HelpOverlay), and KeyHints prints one line of the most relevant keys.

Bindings live on layers (global, pane, overlay). Higher layers are asked first, the newest set wins within a layer, a handler can return false to pass a key on, an exclusive set blocks lower layers (dialogs), and a fallback receives unmatched keys (text fields).

How: key specs such as ctrl+s, shift+tab, and pagedown are parsed into chords and compared with what Ink reports. KeyRegistry holds the active sets and only notifies the UI when the listed bindings change, so inline handlers do not cause re-render loops. Guide in docs/keyboard.md, with tests.

@autoantohaki
autoantohaki merged commit 5fe3813 into main Oct 21, 2026
12 checks passed
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.

1 participant