Имеется следующий код:
#!/bin/bash
teeworlds "connect $1" >/dev/null &
sleep 0.2
TEEID=$(xdotool getwindowfocus)
while :
do
ACTION=$(shuf -i 1-4 -n 1)
case $ACTION in
1) xdotool key --window $TEEID "q" ;;
2) xdotool keyup --window $TEEID "d" &&
xdotool keyup --window $TEEID "a" &&
xdotool keydown --window $TEEID "d" ;;
3) xdotool keyup --window $TEEID "d" &&
xdotool keyup --window $TEEID "a" &&
xdotool keydown --window $TEEID "a" ;;
4) xdotool key --window $TEEID "space" ;;
esac
sleep 0.1
if ! xdotool search --class teeworlds | grep $TEEID >/dev/null
then break; fi
done
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 15 (X_QueryTree)
Resource id in failed request: 0xc6ea37
Serial number of failed request: 1144
Current serial number in output stream: 1144