pinwheel: Move workspaces to monitor on hotplug

Workspace rules alone only affect future workspace creation. Add
moveworkspacetomonitor dispatches so existing workspaces are moved
to the correct monitor when an external display is connected.
This commit is contained in:
Alexander Heldt
2026-02-24 10:07:17 +01:00
parent ac1c5c372f
commit 7d2cf97ea6

View File

@@ -32,14 +32,17 @@ let
# External monitor connected: 1-5 on external, 6-10 on internal
for ws in 1 2 3 4 5; do
$HYPRCTL keyword workspace "$ws, monitor:$external, default:true"
$HYPRCTL dispatch moveworkspacetomonitor "$ws $external"
done
for ws in 6 7 8 9 10; do
$HYPRCTL keyword workspace "$ws, monitor:$INTERNAL, default:true"
$HYPRCTL dispatch moveworkspacetomonitor "$ws $INTERNAL"
done
else
# No external monitor: all workspaces on internal
for ws in 1 2 3 4 5 6 7 8 9 10; do
$HYPRCTL keyword workspace "$ws, monitor:$INTERNAL, default:true"
$HYPRCTL dispatch moveworkspacetomonitor "$ws $INTERNAL"
done
fi
}
@@ -47,7 +50,7 @@ let
handle_event() {
case $1 in
monitoradded*|monitorremoved*)
sleep 0.5 # Give monitor time to initialize
sleep 0.5
bind_workspaces
;;
esac