headless-primary: relocate workspaces stranded on a mirrored output

On swap-back Hyprland brings DP-1 up normal, binds a workspace to it, then apply
mirrors DP-1 — trapping that workspace on a layout-excluded mirror (unreachable;
symptom: 'can't make workspace 1 show'). apply now moves any workspace off a
mirrored output onto the headless primary. Verified the heal operation
(move-off-mirror) manually.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Levi Woodard
2026-07-30 16:10:29 -06:00
parent 0d6da8c24a
commit 0fe38e9797
2 changed files with 24 additions and 5 deletions

View File

@@ -62,7 +62,12 @@ clients. Inherent to cloning an ultrawide.
`hyprctl output remove` is unreliable for these, returns "output not found").
2. Sizes it `5120x1440@60` at `0x0`.
3. If `DP-1` is present → `hyprctl keyword monitor "DP-1,…,mirror,HEADLESS-1"`.
4. Rescues any **orphaned** workspace (`monitorID == -1`) onto the headless
4. **Relocates any workspace stranded on a mirrored output** onto the primary.
On swap-back Hyprland brings `DP-1` up *normal*, binds a workspace to it, and
then we mirror it — leaving that workspace trapped on a layout-excluded
mirror (unreachable). This moves it off. (You can move a workspace *off* a
mirror but not *onto* one, which is why this only bites via hotplug.)
5. Rescues any **orphaned** workspace (`monitorID == -1`) onto the headless
primary — deliberately narrow, so a healthy second monitor (DP-2) is left
alone.
5. **Rescues off-screen floating windows** — recenters any floating, mapped