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:
@@ -26,25 +26,27 @@ let
|
|||||||
}
|
}
|
||||||
|
|
||||||
bind_workspaces() {
|
bind_workspaces() {
|
||||||
local external
|
local external batch=""
|
||||||
|
|
||||||
if external=$(get_active_external); then
|
if external=$(get_active_external); then
|
||||||
# External monitor connected: 1-5 on external, 6-10 on internal
|
# External monitor connected: 1-5 on external, 6-10 on internal
|
||||||
for ws in 1 2 3 4 5; do
|
for ws in 1 2 3 4 5; do
|
||||||
$HYPRCTL keyword workspace "$ws, monitor:$external, default:true"
|
batch="$batch keyword workspace $ws,monitor:$external,default:true;"
|
||||||
$HYPRCTL dispatch moveworkspacetomonitor "$ws $external"
|
batch="$batch dispatch moveworkspacetomonitor $ws $external;"
|
||||||
done
|
done
|
||||||
for ws in 6 7 8 9 10; do
|
for ws in 6 7 8 9 10; do
|
||||||
$HYPRCTL keyword workspace "$ws, monitor:$INTERNAL, default:true"
|
batch="$batch keyword workspace $ws,monitor:$INTERNAL,default:true;"
|
||||||
$HYPRCTL dispatch moveworkspacetomonitor "$ws $INTERNAL"
|
batch="$batch dispatch moveworkspacetomonitor $ws $INTERNAL;"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
# No external monitor: all workspaces on internal
|
# No external monitor: all workspaces on internal
|
||||||
for ws in 1 2 3 4 5 6 7 8 9 10; do
|
for ws in 1 2 3 4 5 6 7 8 9 10; do
|
||||||
$HYPRCTL keyword workspace "$ws, monitor:$INTERNAL, default:true"
|
batch="$batch keyword workspace $ws,monitor:$INTERNAL,default:true;"
|
||||||
$HYPRCTL dispatch moveworkspacetomonitor "$ws $INTERNAL"
|
batch="$batch dispatch moveworkspacetomonitor $ws $INTERNAL;"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
$HYPRCTL --batch "$batch"
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_event() {
|
handle_event() {
|
||||||
|
|||||||
Reference in New Issue
Block a user