41 lines
762 B
Bash
Executable File
41 lines
762 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Dependencies: hyprctl
|
|
# Wait until the window exists
|
|
|
|
floorp &
|
|
|
|
NAME="Floorp"
|
|
CLASS="floorp"
|
|
WORKSPACE=3
|
|
|
|
while true; do
|
|
WIN=$(hyprctl clients -j | jq -r '.[] | select(.class == "'$CLASS'") | .address')
|
|
|
|
if [ -n "$WIN" ]; then
|
|
echo "Found window: $WIN"
|
|
break
|
|
fi
|
|
|
|
echo "Waiting for $NAME window..."
|
|
sleep 0.5
|
|
done
|
|
|
|
# Move to workspace
|
|
while true; do
|
|
# Focus the window
|
|
hyprctl dispatch focuswindow address:$WIN
|
|
|
|
sleep 0.1
|
|
|
|
ACTIVE=$(hyprctl activewindow -j | jq -r '.address')
|
|
|
|
if [ "$ACTIVE" = "$WIN" ]; then
|
|
echo "Window is now focused: $WIN"
|
|
hyprctl dispatch movetoworkspace $WORKSPACE
|
|
break
|
|
fi
|
|
|
|
echo "Waiting for focus..."
|
|
sleep $((RANDOM % 3))
|
|
done |