Skip to content

End the bind scan's stub window list instead of looping on it - #15308

Closed
nekomario28 wants to merge 4 commits into
omacom:quattrofrom
nekomario28:menu-keybindings-stub-ipairs
Closed

nekomario28 wants to merge 4 commits into
omacom:quattrofrom
nekomario28:menu-keybindings-stub-ipairs

Conversation

@nekomario28

Copy link
Copy Markdown
Contributor

omarchy-menu-keybindings (SUPER + K) builds its Lua bind cache by reading ~/.config/hypr/hyprland.lua against a stub hl. The stub is one object that answers every call with itself, so a plugin that walks ipairs(hl.get_windows()) while the config loads reads a truthy value at every index and never ends — the cheatsheet pins a core until it is killed.

The stub now answers a numeric index with nil, so an ipairs() over a stubbed getter ends, while chained calls (hl.something.other()) still resolve to the stub.

test/shell.d/keybindings-menu-test.sh covers it: it prepends a window walk to the config and runs the scan under a timeout. With the change reverted, that check fails on the timeout; with it, the file passes.

Fixes #15216.

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

The bind scan now treats numeric lookups on its Lua stub as an empty list, so a plugin walking windows can finish.

  • The keybindings scan now finishes when plugins walk stubbed window lists.

Reviews (2) · Last reviewed commit: "End the bind scan's stub window list ins..." · Reviewed by Greptile

Comment thread test/shell.d/keybindings-menu-test.sh Resolved
omarchy-menu-keybindings builds a Lua bind cache by reading
~/.config/hypr/hyprland.lua against a stub hl. The stub answers every call
with one self-referential object, so ipairs(hl.get_windows()) -- a plugin
walking the window list as the config loads -- gets a truthy value at every
index and never ends, pinning a core until the cheatsheet is killed.

Answer a numeric index with nil so an ipairs() over a stubbed getter ends,
and cover it in the keybindings test.
@nekomario28
nekomario28 force-pushed the menu-keybindings-stub-ipairs branch from c10f0b3 to 3f17562 Compare October 13, 2026 15:30
The commands under test call each other: omarchy-battery-status runs
omarchy-i18n, and omarchy-i18n reads OMARCHY_PATH. A test run from a checkout
had neither on hand, so any test whose command reaches another one failed with
`omarchy-i18n: command not found` or `OMARCHY_PATH: unbound variable`.
test/shell.d/i18n-test.sh already exports both for itself; base-test.sh, which
the rest source, did not.

bash test/shell on quattro: 32 of 419 files fail. With these two lines: 17 of
419, and every one of the 17 also fails before this change, so nothing new
fails. Four of the fifteen are a regression from the language work (omacom#15326):
battery-status, crash-capture, hyprland-workspace-layout and keybindings-menu
pass at 84cfb93^ and fail at 84cfb93.
…tub-ipairs

# Conflicts:
#	test/shell.d/keybindings-menu-test.sh
@omarchybot

Copy link
Copy Markdown
Collaborator

@nekomario28, I reviewed this against the other open pull requests for #15216. The fix is correct: making the bind scan's noop stub in bin/omarchy-menu-keybindings return nil for a numeric index ends ipairs() over a stubbed getter, and I found no defect in it or in the new test. But five other open pull requests fix the same hang, and two of them make the same change: #7564 (opened 2026-08-20) and #12712 (opened 2026-09-21), both against quattro.

When fixes are similar, the oldest one wins, so the first to the fix keeps the credit. That is #7564. It returns nil for a numeric index the same way, also puts a timeout on the scan, and gives the stub comparison, arithmetic and concatenation metamethods, so a config that does monitor.scale > 0 on a stubbed value no longer aborts the scan and drops the binds after it. This pull request does not fix that case. I have asked the maintainer to choose between them rather than marking this one ready.

One part of this pull request is worth keeping: the end-to-end test in test/shell.d/keybindings-menu-test.sh. It puts a window walk at the top of the config, runs the whole menu under a timeout, and checks that the Lua-only Terminal bind still resolves. #7564 only tests the scan on its own, so I have asked for this test to be carried into #7564 with credit to you. The PATH/OMARCHY_PATH change in test/shell.d/base-test.sh that this branch merges in is still open as your #15459, so nothing here depends on this pull request landing.

What was checked: I read the diff, the surrounding scanner code and each competing diff. Nothing ran on a worker, because verifying a fix that is not the one going forward would spend a worker on nothing. Codex Medium, given this pull request and its competitors without my conclusion, also picked #7564, and it found the same test worth carrying over. That agreement is not guaranteed to be independent. Asked separately whether this duplicates #12712, it said no, so this stays open. Next step: the maintainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

omarchy-menu-keybindings Lua stub makes ipairs infinite (Super+K hang with plugins using hl.get_windows)

2 participants