monitor-workspaces.lua: workspaces shift up by +1 after monitor sleep/reconnect
System details
- Hardware: Framework Desktop, AMD Ryzen AI Max+ 395 w/ Radeon 8060S (
amdgpu) - Monitor: Single display on
HDMI-A-1(Samsung Electric Company S24R35xFZ) - Omarchy:
4.6.0rc2-1(default/hypr/monitor-workspaces.luaidentical tomasterat2dfb187f) - Hyprland:
0.57.2-11(omarchy), kernel7.3.6-5-omarchy
What happens
After idle / monitor sleep (DPMS off causes the monitor to drop HPD and disconnect) and waking back up, all contiguous workspaces starting from workspace 1 have their numbers incremented by +1 (1 → 2, 2 → 3, 3 → 4, ...).
State file evidence (~/.local/state/omarchy/monitors/workspaces):
0 HDMI-A-1 Samsung Electric Company S24R35xFZ H4CW200887K
1 FALLBACK
Root cause
Two bugs in default/hypr/monitor-workspaces.lua combine to produce the shift:
-
connected()(L153-L160) does not exclude Hyprland'sFALLBACKmonitor (unlikeshell/Ui/OverlayWindow.qml:25):- When the sole physical monitor (
HDMI-A-1, block0) disconnects on sleep, Hyprland createsFALLBACK. assign()givesFALLBACKblock1(11–20) and persists it in~/.local/state/omarchy/monitors/workspaces.own_views()creates empty workspace11onFALLBACK.merge()(L630-L655) seesHDMI-A-1is gone and callsappend_slot(1)for each occupied workspace on block0. Because workspace11exists,1, 2, 3, ...are renumbered to12, 13, 14, ...withorigin.id = 1, 2, 3, ....
- When the sole physical monitor (
-
restore()(L616-L620) collides with the empty placeholder workspace Hyprland creates on the returning monitor:- When
HDMI-A-1reconnects, workspace1is free (it was renumbered to12), so Hyprland placesHDMI-A-1on a fresh empty workspace1. restore()runs:if block_of_id(origin.id) == by_connector[monitor.name] and not hl.get_workspace(origin.id) then renumber(workspace, origin.id) elseif block_of_id(id) ~= by_connector[monitor.name] then adopt(workspace, by_connector[monitor.name]) end- For
12(origin.id = 1),hl.get_workspace(1)is non-nil (the empty placeholder), sorestore()falls through toadopt(ws 12, 0)→ slot2. - For
13(origin.id = 2), workspace2is now taken by old workspace1, soadopt(ws 13, 0)→ slot3. - Every contiguous workspace starting at
1cascades up by+1.
- When
Bug 2 also affects multi-monitor setups whenever the block-0 monitor (1–10) is unplugged and replugged, even without FALLBACK.
Steps to reproduce
- On a single-monitor setup (block
0), open windows on workspaces1,2, and3. - Let the display disconnect on idle/sleep (or disable the output so Hyprland falls back to
FALLBACK), then reconnect/wake it. - Observe workspaces
1, 2, 3have become2, 3, 4.
Expected
Workspaces keep their original numbers (1, 2, 3) after monitor sleep/reconnect, and FALLBACK is never assigned a workspace block.
Suggested fix
- Ignore
monitor.name == "FALLBACK"inconnected(), soreconcile()returns early when no real monitors are attached (instead of merging workspaces intoFALLBACK). - In
restore(), ifhl.get_workspace(origin.id)exists onmonitorwith0windows, switchmonitorto the returning workspace first so Hyprland destroys the empty placeholder, thenrenumber(workspace, origin.id).
Related: #19564 (same FALLBACK side note; open PRs #19641 / #17488 don't fix this shift), #17776 (similar empty-placeholder fix in move_to_monitor() only).
Filed by Gemini 4 Neon via Antigravity.
Closing as a duplicate of #16328. That thread already covers the single-monitor case where Hyprland's temporary FALLBACK output gets a workspace block and an empty workspace on reconnect pushes the returning workspaces to higher numbers. #17213 addresses the fallback block, and #16349 addresses the empty-workspace collision. This can be reopened if there's a case those fixes miss.
GPT-6 High in Codex compared the reports against quattro. Opus 5.5 High agreed they describe the same bug. The independence of that agreement is unconfirmed. This was a source review.