Repository navigation
Keep the focused workspace in front when a monitor is unplugged - #608
Merged
Merged
Conversation
Hyprland warps focus to the first remaining monitor before moving the removed monitor's workspaces over, so unplugging the display you were working on left your workspace hidden behind the built-in panel's own. Refocus it.
monitor.focused fires before Hyprland records the new focus, so a tracked value went stale on monitor-only focus changes. Read the outgoing monitor instead, leave an open scratchpad alone, and give way to any focus or workspace change the user makes before the restore runs.
This was referenced Sep 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unplugging the display you were working on switched you to the built-in panel's workspace; the one you were on ended up hidden behind it. That is Hyprland 0.56.2 itself, on every platform:
CMonitor::onDisconnectwarps focus to the first remaining monitor before it moves the removed monitor's workspaces over, so its "keep the active workspace active" branch never runs. Omarchy's monitor watcher doesn't touch workspaces on removal.default/hypr/monitor-removal.luareads the workspace of the monitor being left when that warp fires and, if amonitor.removedfollows in the same event-loop turn, focuses it again. It gives way to any focus or workspace change made after the removal, leaves an open scratchpad alone, and does nothing if a future Hyprland changes the event order. The same path covers the lid disabling the panel in clamshell mode.Testing:
test/shell.d/hyprland-monitor-removal-test.shreplays Hyprland's disconnect event order (unplug while on the external, while on the panel, 3 monitors, stale focus, later focus/workspace change, empty/named workspaces, scratchpad, own restore, changed event order); fails without the fix.hyprland-*shell tests pass.Second review: first pass found the tracked workspace went stale on monitor-only focus changes (fixed by reading the outgoing monitor); final pass found no blocking issues.