Skip to content

Cache resolved tmux keybindings and parse monitor height without jq - #19881

Merged
dhh merged 2 commits into
quattrofrom
faster-tmux-keybindings
Nov 23, 2026
Merged

dhh merged 2 commits into
quattrofrom
faster-tmux-keybindings

Conversation

@dhh

@dhh dhh commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

What changes

Speeds up Super + Alt + K (bin/omarchy-menu-tmux-keybindings) and Super + Ctrl + K (bin/omarchy-menu-herdr-keybindings):

  • Disk cache for resolved Tmux keybindings: omarchy-menu-tmux-keybindings previously booted a throwaway tmux server (tmux -S ... start-server, sourcing tmux.conf, listing all tables, then killing the server) on every press. It now caches the rendered records under ${XDG_CACHE_HOME:-$HOME/.cache}/omarchy/tmux-keybindings-<hash>.records keyed on tmux -V and the config file contents, atomically replacing stale cache files on change. Configs containing top-level source-file/source/if-shell/run-shell directives bypass the cache so dynamic includes are never served stale.
  • Avoid jq for focused monitor height: parses the focused monitor's height from hyprctl monitors via awk in both bin/omarchy-menu-tmux-keybindings and bin/omarchy-menu-herdr-keybindings.

Verification

  • Verified omarchy-menu-tmux-keybindings --print output is byte-identical before and after caching.
  • Verified cache hit, cache invalidation + old-file cleanup when tmux.conf changes, and cache bypass when a top-level source-file directive is present.
  • Verified awk monitor height parser matches hyprctl monitors -j | jq (1200 on this machine).
  • Benchmarked omarchy-menu-tmux-keybindings --print (5 runs): dropped from 36.2ms min to 15.2ms min.

Screenshots

No visible change: the Tmux and Herdr keybindings menus render identical rows and heights.

@greptile-apps

greptile-apps Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; both previous findings are addressed.

Summary

Adds a disk cache for resolved Tmux keybindings and replaces jq with awk when reading monitor height.

  • The Tmux keybindings menu reuses saved records for unchanged configs.
  • Both keybinding menus read focused monitor height without jq.

Reviews (2) · Last reviewed commit: "Handle chained tmux directives and concu..." · Reviewed by Greptile

Comment thread bin/omarchy-menu-tmux-keybindings Resolved
Comment thread bin/omarchy-menu-tmux-keybindings Resolved
@omarchybot omarchybot added the enhancement New feature or request label Nov 23, 2026
@dhh
dhh merged commit eef5780 into quattro Nov 23, 2026
3 checks passed
@dhh
dhh deleted the faster-tmux-keybindings branch November 23, 2026 09:00
@emirb emirb added this to the 4.6.0 milestone Dec 1, 2026
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.

3 participants