diff --git a/audiogame-manager.sh b/audiogame-manager.sh index 8e6bd73..022392b 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -35,20 +35,20 @@ write_sequence_storm_reader() { cat << "EOF" > ~/.SequenceStormReader #! /bin/bash +# Wait for the game to be launched +while ! pgrep -u $USER ^SequenceStorm &> /dev/null ; do + sleep 0.05 +done + export DISPLAY=:0 -close=-1 unset cliptext -while [[ $close -ne 0 ]]; do +while pgrep -u $USER ^SequenceStorm &> /dev/null ; do tmp="$(xclip -selection clipboard -o)" if [ "$tmp" != "$cliptext" ] ; then cliptext="$tmp" spd-say -r 50 "$cliptext" fi sleep 0.05 - if [ $(pgrep -cu $USER SequenceStorm) -eq 0 -a $close -eq -1 ]; then - continue - fi - close=$(pgrep -cu $USER SequenceStorm) done exit 0