Skip to content

Fix out-of-range group window shortcuts - #8411

Open
wxasacoder wants to merge 3 commits into
omacom:quattrofrom
wxasacoder:codex/fix-group-window-index
Open

wxasacoder wants to merge 3 commits into
omacom:quattrofrom
wxasacoder:codex/fix-group-window-index

Conversation

@wxasacoder

@wxasacoder wxasacoder commented Aug 26, 2026 •

Copy link
Copy Markdown

Problem

Omarchy binds Super + Alt + 1 through Super + Alt + 5 directly to hl.dsp.group.active.

When the active group contains fewer windows than the selected index, Hyprland returns an Index out of range Lua runtime error. For example, with two windows in a group, Super + Alt + 1 and Super + Alt + 2 work, but pressing Super + Alt + 3 produces an error notification. Repeated key presses can fill the screen with these notifications.
screenshot-2026-08-26_22-39-18

Solution

Resolve the active window and its group when the shortcut is pressed, then dispatch the group switch only when the requested index is within group.size.

Valid group window shortcuts retain their existing behavior. Shortcuts targeting unavailable group positions, or used outside a window group, now safely do nothing.

This uses Hyprland's Lua window and group APIs directly instead of catching or matching runtime error messages.

Testing

  • Added a regression test covering valid, out-of-range, and ungrouped window shortcuts.
  • Ran bash test/shell.d/hyprland-group-bindings-test.sh.
  • Ran bash test/shell.d/hyprland-binding-conflicts-test.sh.

Copilot AI balanced review requested due to automatic review settings August 26, 2026 15:35
@wxasacoder

Copy link
Copy Markdown
Author

Testing

Added regression coverage for:

  • Switching to a valid group window
  • Requesting an index greater than the group size
  • Using the shortcut when the active window is not grouped

Focused tests:

  • bash test/shell.d/hyprland-group-bindings-test.sh
  • bash test/shell.d/hyprland-binding-conflicts-test.sh

Manual verification

Tested in a live Omarchy session with two grouped windows:

  • Super + Alt + 1 and Super + Alt + 2 still switch between the grouped windows normally.
  • Super + Alt + 3, Super + Alt + 4, and Super + Alt + 5 are ignored without producing Lua runtime errors.
screenrecording-2026-08-26_23-51-11.mp4

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread test/shell.d/hyprland-group-bindings-test.sh
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
Lua 5.5 exits 0 when a script it reads from a pipe errors, so `lua <<'LUA'` swallowed every failed assertion and the test passed with the fix reverted. `lua -` reads the same heredoc and exits 1 on an error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed and tested on a disposable Omarchy VM (Hyprland 0.56.2) by Claude Opus 5.5. The fix works: with a two-window group, real Super+Alt+3 and Super+Alt+5 key presses show Runtime error in lua: Index out of range on current quattro, show nothing on this branch, and show it again with the tiling.lua change reverted. Super+Alt+1 and 2 still switch between the grouped windows, so building the dispatcher once and re-dispatching it on each press holds up.

I pushed one commit to your branch, b203ddc. The new test could not fail: on Lua 5.5, lua <<'LUA' exits 0 when the script errors, so it passed with the fix reverted even though its assertions failed. It now runs lua - <<'LUA', which exits 1 on an error. It fails on quattro, fails when only the group.size check is removed, and passes here. ./test/cli and ./test/shell fail the same 62 checks on this branch as on quattro, mostly because node is missing on the test VM, so nothing new breaks.

This fixes #12085. #10693 makes the same change later without a test, and #12155 includes it among five unrelated fixes. This one is the one to take forward.

One side effect, found by reading the code rather than running it: as Lua functions, these five binds can no longer be run from the keybindings menu (omarchy-menu-keybindings finds no dispatcher for them). That already happens with the clipboard binds, and pressing the keys works as before.

No second opinion ran. Codex Medium, the configured reviewer, answered a ping but refused the review because today's review budget is used up. For the same reason the classification at the new head could not be confirmed, so the verified label and the link to #12085 wait for the next pass. Nothing is waiting on you.

@omarchybot omarchybot removed the bug Something isn't working label Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants