Skip to content

Skip group window hotkeys past the end of the group - #15100

Open
omarchybot wants to merge 1 commit into
quattrofrom
fix/issue-12085
Open

omarchybot wants to merge 1 commit into
quattrofrom
fix/issue-12085

Conversation

@omarchybot

Copy link
Copy Markdown
Collaborator

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)' in o.bind_commands, the same way o.launch_terminal does, 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

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]>
@greptile-apps

greptile-apps Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] This PR appears safe to merge; no actionable issues were found.

Summary

Group-window hotkeys now check the focused group's size before switching.

  • Group-window number keys skip windows the group does not have.

Reviews (1) · Last reviewed commit: "Skip group window hotkeys past the end o..." · Reviewed by Greptile

merkhanov added a commit to merkhanov/omarchy that referenced this pull request Oct 14, 2026
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]>
@omarchybot omarchybot added the bug Something isn't working label Oct 17, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator Author

Reviewed against quattro alongside the other open fixes for #12085. This pull request fixes the cause, but #8411 by @wxasacoder makes the same fix and is older, so that is the one being brought forward and this one waits on the maintainer.

Both check the focused window's group size before dispatching hl.dsp.group.active, so Super+Alt+1 to 5 switch only to a window the group has and do nothing outside a group. The one thing this pull request adds is the Super+K keybindings menu: #8411 turns the five binds into functions without an o.bind_commands entry, so bin/omarchy-menu-keybindings emits no command for them and selecting "Switch to group window 2" from the menu does nothing, where on quattro it switches. This pull request registers hyprctl eval 'o.switch_group_window(n)' for each, the way o.launch_terminal does in default/hypr/helpers.lua. That improvement is being folded into #8411 with credit, rather than replacing it. #12155 carries the same change bundled with four unrelated fixes.

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.

@omarchybot

Copy link
Copy Markdown
Collaborator Author

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 hyprctl eval 'o.switch_group_window(n)' in o.bind_commands, the way this one does. #8411 was run on a disposable Omarchy VM at that head, and Super+Alt+3 and 5 on a two-window group show no error there, 1 and 2 still switch, and the menu entry switches the window. It is labelled verified.

I compared the two diffs again for this run, and Codex Medium did the same separately. Both have the same index <= group.size bound, the same ungrouped-window case and the same five menu commands. Codex found nothing this pull request has that #8411 lacks, and no defect in #8411 that this one avoids. It reached that answer on its own, but it can read this session's working files, so its independence is not guaranteed. Nothing was run on a worker for this pull request, because it is not the fix going forward.

Everything here is now covered by #8411, so this one can be closed when #8411 is merged. That is the maintainer's decision.

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.

Super+Alt+number shows an error for unavailable group windows

1 participant