Skip to content

Keep the focused workspace in front when a monitor goes away - #14518

Draft
maralcbr wants to merge 1 commit into
omabot/pr-13362from
keep-workspace-on-monitor-removal
Draft

maralcbr wants to merge 1 commit into
omabot/pr-13362from
keep-workspace-on-monitor-removal

Conversation

@maralcbr

@maralcbr maralcbr commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

When an active monitor goes away, Hyprland can move its workspace to a remaining monitor while showing a different workspace there. Keep the workspace the user was viewing in front on the remaining monitor.

A Lua handler remembers the active workspace during monitor removal and defers refocusing until Hyprland has moved it. It leaves scratchpads and any subsequent user focus change alone, and skips the restore if the workspace no longer exists. This applies to every platform.

Stacked on #14431.

Brings back the workspace refocus split out of omacom#14431 so it gets its own review: when a monitor is unplugged, the workspace the user was viewing stays in front on the remaining monitor instead of whatever Hyprland picks.
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed this separate three-file scope with Claude Opus 5.5 High via Pi, which found nothing actionable; agreement is not guaranteed independent. On an isolated x86 ISO worker with real Hyprland, removing a headless monitor showing a populated workspace switched focus from workspace 42 to 9 without the handler and kept 42 in front with it. The focused Lua checks also pass.

This remains a draft stacked on #14431 so the workspace behavior stays outside the Apple compatibility change. After #14431 lands, its branch must be updated with the landed core and retargeted to quattro before this can land separately.

@maralcbr

Copy link
Copy Markdown
Member Author

@ryanrhughes this needs your opt-in before I mark it ready.

When a display is unplugged, or the lid turns it off, Hyprland 0.56.2 moves focus to the remaining monitor before moving the workspaces. The workspace you were on ends up behind. This is a small Lua handler in default/hypr that reacts to monitor.removed, with no polling and no daemon. The bot reproduced it on an x86 worker.

It changes default behaviour for every laptop that docks or clamshells, x86 included, with no toggle. If you want it, I'll open a fresh PR against quattro and close this one, since its base was #14431's branch. The new one will:

  • handle two displays going at once (currently the second cancels the first)
  • guard against the event order Hyprland main changes in the next release
  • link an upstream Hyprland bug

#9209 hooks monitor.removed too. Happy to fold the two into one module if you'd prefer.

@maralcbr

Copy link
Copy Markdown
Member Author

Upstream report: hyprwm/Hyprland#16522 (reproduced on 0.56.2 with a headless output). The reworked version is ready locally: it handles two displays going at once and loads only on Hyprland 0.56.2, since later releases move workspaces before the warp.

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.

2 participants