Files
hyprland-dotfiles/.config/hypr/scripts/tiling-helper/move-grayjay.sh
2025-10-16 20:50:11 +02:00

32 lines
831 B
Bash
Executable File

#!/bin/bash
timeout=50 # 10 seconds max (50 * 0.2s)
count=0
while (( count < timeout )); do
# Grab both address and floating status
read -r win_addr floating <<< $(hyprctl -j clients | jq -r '.[] | select(.title == "Grayjay") | "\(.address) \(.floating)"')
if [[ -n "$win_addr" ]]; then
# Add 0x prefix if missing
if [[ "$win_addr" != 0x* ]]; then
win_addr="0x$win_addr"
fi
# If the window is floating, toggle to make it tiled
if [[ "$floating" == "true" ]]; then
hyprctl dispatch togglefloating address:$win_addr
fi
# Move to workspace 2 silently
hyprctl dispatch movetoworkspacesilent 2,address:$win_addr
exit 0
fi
sleep 0.2
((count++))
done
echo "Grayjay window not found within timeout." >&2
exit 1