#16128
Stop the keybindings menu's config scan from hanging
What
The keybindings menu reads the user's Hyprland config for the binds Hyprland reports as Lua. It does that with a stub of Hyprland's Lua API, so the config can be loaded without a compositor running.
The stub answered every index, so a config that walks a result set while it loads (ipairs(hl.get_monitors())) never finished: ipairs over a table that answers every index is an endless loop. The menu then waited on the scan, and the scan sat at 100% CPU. The chord for the keybindings menu did nothing.
The fix
- The stub answers a numeric index with
nil, which is the empty result set such a config has to see. - The scan runs under a budget (10 seconds;
OMARCHY_KEYBINDINGS_SCAN_TIMEOUToverrides it). The scan only fills in what Hyprland leaves out, so a config that never finishes loading must not keep the menu from opening: the menu falls back to the binds Hyprland reports, which are the truth anyway.
Tests
test/shell.d/keybindings-menu-config-scan-test.sh covers both halves: a config that walks a result set still reaches the binds declared after it, and a config that never finishes loading still opens the menu.
Activity
4greptile-apps[bot]reviewed16h ago
[Medium impact] The change affects the keybindings menu's local config scan.
Fix the caching of timed-out scans before merging; otherwise a temporary delay can leave menu actions broken.
Findings
Summary
The PR stops numeric lookups on the Lua stub from producing endless result lists and adds a configurable scan budget.
Reviews (1) · Last reviewed commit: "Give the keybindings menu's config scan ..." · Reviewed by Greptile