Use tmux to list keybindings#6308
Conversation
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dhh
left a comment
There was a problem hiding this comment.
Love the instinct here — the awk parser deserved to die, and letting tmux report its own state is the right direction. But as written this trades away more than it deletes. Three things to fix before this can go in:
1. Output readability. The old viewer printed ~45 curated lines like PREFIX + c → New window. This prints 310 raw bind-key lines, ~265 of which are tmux's built-in copy-mode defaults, drowning out the Omarchy bindings — and it's feeding end-user surfaces (the menu popup and PREFIX + ?). Suggestion: use tmux list-keys -N instead, and add -N "description" notes to the binds in config/tmux/tmux.conf. That gives clean, annotated output with the prefix already resolved (C-Space c Create a new window), moves the descriptions into the config next to the bindings they describe, and still deletes the whole parser.
2. --config is silently ignored when a server is running. tmux only reads -f at server start, so with a live server (which is always the case for the PREFIX + ? binding) the flag does nothing — verified with a running server on one config and -f pointing at another. Pick one semantic: either config-file-authoritative (run on an isolated socket, e.g. tmux -L omarchy-keybindings -f "$config_file") or live-server (drop --config and the file checks). Right now the answer depends on invisible state.
3. Side effects on the default socket. When no server is running, this starts a real one and fully sources the user's config (including any run-shell hooks) just to print keybindings — and a config with set -g exit-empty off leaves that server orphaned. An isolated -L socket for the cold path fixes this too.
Also a nit: the omarchy:summary comment still says "defined in your configuration," which stops being true once defaults are listed.
Verified the output count/readability, alternate-config behavior with a live default server, unchanged default-server state, socket cleanup, and EDIT: Used at dhh because I changed commit author to use my username |
b2b9ed6 to
051f89b
Compare
… own list-keys -aN falls back to the raw command when a binding has no note, so user-added bindings in an existing tmux.conf still show up. Dropping exit-empty off means the throwaway server exits when the client disconnects instead of relying solely on the trap. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Use tmux to list keybindings * Annotate tmux keybindings * List unannotated bindings too and let the isolated server exit on its own list-keys -aN falls back to the raw command when a binding has no note, so user-added bindings in an existing tmux.conf still show up. Dropping exit-empty off means the throwaway server exits when the client disconnects instead of relying solely on the trap. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: David Heinemeier Hansson <david@hey.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Summary
tmux list-keys -Noutput--configauthoritative on a per-invocation isolated socket that is always cleaned upThis removes 234 lines net without touching the default tmux server.
Tests
bash -n bin/omarchy-menu-tmux-keybindingsexit-empty offleaves no server or socket behind./test/all