pinwheel: Batch workspace monitor assignments atomically

Use hyprctl --batch to send all workspace rules and moves in a
single IPC call, avoiding races that caused workspaces to end up
on the wrong monitor.
This commit is contained in:
Alexander Heldt
2026-03-04 11:24:13 +01:00
parent edafaf04de
commit dee1aa02e6

View File

@@ -26,25 +26,27 @@ let
}
bind_workspaces() {
local external
local external batch=""
if external=$(get_active_external); then
# 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"
batch="$batch keyword workspace $ws,monitor:$external,default:true;"
batch="$batch 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"
batch="$batch keyword workspace $ws,monitor:$INTERNAL,default:true;"
batch="$batch 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"
batch="$batch keyword workspace $ws,monitor:$INTERNAL,default:true;"
batch="$batch dispatch moveworkspacetomonitor $ws $INTERNAL;"
done
fi
$HYPRCTL --batch "$batch"
}
handle_event() {