virtual (711B)
1 #!/usr/bin/env bash 2 3 set -euo pipefail 4 5 cleanup() { 6 pkill -f wayvnc || true 7 hyprctl output remove Virtual-1 || true 8 } 9 10 trap cleanup EXIT 11 12 hyprctl output create headless Virtual-1 13 14 nohup wayvnc 0.0.0.0 5900 "Virtual-1" > wayvnc.out & 15 16 sleep 2 17 18 CLIENTS=$(hyprctl clients -j | jq -r '.[] | select(.class | test("chromium"; "i")) | .address') 19 20 COUNT=$(echo "$CLIENTS" | wc -l) 21 22 echo "Found $COUNT Chromium window(s). Moving them to Virtual-1..." 23 24 for ADDR in $CLIENTS; do 25 echo "→ Moving window $ADDR" 26 hyprctl dispatch focuswindow address:"$ADDR" >/dev/null 27 hyprctl dispatch movewindow mon:Virtual-1 >/dev/null 28 sleep 0.2 29 done 30 31 hyprctl keyword monitor Virtual-1,preferred,auto,1 32 33 sleep infinity