Files
hypr/scripts/autostart/keepass.sh
T
Hannes 0c8deaa90b base
2026-05-08 17:53:39 +02:00

41 lines
787 B
Bash
Executable File

#!/bin/bash
# Dependencies: hyprctl
# Wait until the window exists
keepassxc &
NAME="KeePassXC"
CLASS="org.keepassxc.KeePassXC"
WORKSPACE=401
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