Repository navigation
Skip group window hotkeys past the end of the group - #15100
omarchybot wants to merge 1 commit into
Conversation
Super+Alt+3 in a group of two made Hyprland reject the index and show "Runtime error in lua: Index out of range". The binding now checks the focused window's group size first and does nothing when the group has no window at that position. A function bind is one the keybindings menu cannot run on its own, so each one registers the hyprctl eval of the same helper in o.bind_commands, keeping the five entries runnable from the menu as they were. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-Authored-By: Codex Medium <[email protected]>
|
The pcall guard this branch added made the binds Lua functions, and the keybindings menu's scanner records a dispatcher only for an __omarchy_dispatcher table, a string, or an o.bind_commands lookup (bin/omarchy-menu-keybindings). A function matched none of those, so the cached dispatcher came back empty, overwrote the __lua one that `hyprctl binds` reports, and dispatch_binding returned 1. Picking "Switch to group window 2" from the menu did nothing even when the group had a second window. The pcall was also the wrong guard. Hyprland reports the rejection through its dispatcher result rather than by raising a Lua error, so it would still have notified. Check the focused window's group size before dispatching, so nothing is dispatched past the end of the group and Hyprland has nothing to reject, and register the equivalent command in o.bind_commands so the menu can still run the bind. Same approach as omacom#15100. The window.group.size shape is the one omarchybot verified on a Hyprland 0.56.2 VM against omacom#8411. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Reviewed against Both check the focused window's group size before dispatching Nothing was run on a worker for this pull request: a fix that is not the one going forward does not need one, and #8411 is verified on its own. The second opinion, Codex Medium, was asked which fix should go forward without being given this answer; it reached the same conclusion, found no defect in this pull request's implementation, and confirmed the menu regression in #8411. It can read this session's working files, so its independence is not guaranteed. Whether to close this one once #8411 lands with the menu fix is the maintainer's call. |
|
The keybindings menu change this pull request added has now been folded into #8411, which is at 4d565f7. In #8411, each of Super+Alt+1 to 5 registers I compared the two diffs again for this run, and Codex Medium did the same separately. Both have the same Everything here is now covered by #8411, so this one can be closed when #8411 is merged. That is the maintainer's decision. |
Super+Alt+1 to 5 switch to that window in the focused group, but the binds dispatched
hl.dsp.group.active({ index = n })whatever the group's size. In a group of two, Super+Alt+3 asks for a window that is not there, Hyprland 0.56.2 rejects the index, and because the bind is Lua it reports the rejection as a "Runtime error in lua: Index out of range" notification. Reproduced on a worker on Hyprland 0.56.2 with a real keypress.Each bind now calls
o.switch_group_window(index), which dispatches only when the focused window is in a group with at least that many windows (hl.get_active_window().group.size; the index is 1-based, as Hyprland's own bounds check is). A press for a window the group does not have does nothing, and an ungrouped window does nothing as before.A function bind is one the keybindings menu cannot run by itself, so each registers
hyprctl eval 'o.switch_group_window(n)'ino.bind_commands, the same wayo.launch_terminaldoes, and the five entries stay runnable from Super+K.Reviewed by Codex Medium, which checked the bound against Hyprland's source; its last pass on this revision was clean.
Fixes #12085