#16128

Stop the keybindings menu's config scan from hanging

Openiaikanshbwants to merge intofrom

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_TIMEOUT overrides 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

4
greptile-apps[bot]16h ago

Confidence Score: 4/5

[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

  1.  Timed-out scans leave broken actions ▶
  2.  Children can outlive the budget ▶

Summary

The PR stops numeric lookups on the Lua stub from producing endless result lists and adds a configurable scan budget.

  • Keybindings menu scans finish without waiting forever on config loops.

Reviews (1) · Last reviewed commit: "Give the keybindings menu's config scan ..." · Reviewed by Greptile

greptile-apps[bot]reviewed16h ago