Skip to content

Add reverse keybinding inspector with safe chord capture - #10402

Open
MkeyFrzn3s wants to merge 1 commit into
omacom:quattrofrom
MkeyFrzn3s:keybinding-inspector
Open

MkeyFrzn3s wants to merge 1 commit into
omacom:quattrofrom
MkeyFrzn3s:keybinding-inspector

Conversation

@MkeyFrzn3s

@MkeyFrzn3s MkeyFrzn3s commented Sep 5, 2026 •

Copy link
Copy Markdown

Problem

The keybindings guide is great for browsing by name, but not for answering “what does this chord do?” without firing the binding. Typing to search still works; reverse lookup did not.

Behavior

Open the keybindings guide (Super + K / omarchy-menu-keybindings). With shortcut capture armed:

  1. Press a keyboard shortcut → the matching row(s) are shown. The physical chord does not execute (Wayland ShortcutInhibitor).
  2. Release → back to the full list with that row selected.
  3. Enter (or click) → run it like any other menu selection.

Misses stay silent (no sticky “unsupported” banners). Bare Escape exits; Super + Escape is inspected as a chord. Shift+digit chords (e.g. move window to workspace) match via scan code, because Qt often reports Key_Exclam on press and Key_4 on release.

Typing still filters by text; a chord lookup is the other direction of the same guide.

Safety

  • Capture is only requested for this guide (--inspect-keybindings), not for every dmenu.
  • While a chord is held, Enter / click do not dispatch.
  • Bindings that bypass inhibition, ignore modifiers, are device/media/mouse, multi-key, or otherwise unsafe for capture stay text-searchable but are not physically inspectable.
  • Bash supported_key and MenuModel naming are kept in sync via a parity test.

Limitations

  • Media / XF86 / mouse chords are intentionally out of physical capture (MVP keyboard-only).
  • Lua function binds such as Universal copy/paste/cut and zoom are inspectable after metadata fixes, but menu Enter may still not reconstruct a dispatcher for pure Lua functions (same as selecting those rows by name today).
  • Web-app static chords (Shift+Alt+L/D) remain “static binding context unavailable.”

Tests

  • ./test/shell.d/keybinding-inspector-test.sh — normalize/classify, silent/release contracts, Shift+digit scan hold, allowlist parity
  • ./test/shell.d/keybindings-menu-test.sh — inspection metadata, SUPER+SHIFT+code:10 round-trip, function-bind inspectability

Test plan

  • Run the two shell tests above
  • Open the guide: Super + W → release → row selected → Enter closes the window
  • Super + Shift + digit settles on the workspace row (not stuck filtered)
  • Super + Escape inspects; bare Escape exits
  • Volume/brightness media keys remain findable by typing, not by pressing

I used this a lot while building it and had fun putting it together. Happy to iterate if anything’s off.

Press a shortcut in the keybindings guide to find its row, settle selection on release (including Shift+digit scan-code holds), and keep unsafe bindings text-searchable only.

Co-authored-by: Cursor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants