From a2cce62b1fd922a426ffe1e7bd38f986ef889cad Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Thu, 6 Oct 2022 11:54:24 -0400 Subject: [PATCH] Updated the window title speaking script to function more like clipboard translator. This means you don't need to launch it before opening games that require it any more. --- audiogame-manager.sh | 4 +++- speech/speak_window_title.sh | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index bd45148..da8eb4f 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -795,6 +795,9 @@ game_launcher() { "${0%/*}/speech/clipboard_translator.sh" play.exe & fi fi + if [[ "$game" =~ road-to-rage\| ]]; then + "${0%/*}/speech/speak_window_title.sh" trtr.exe & + fi if [[ "$game" =~ sequence-storm ]]; then [[ -x ~/.SequenceStormReader ]] && ~/.SequenceStormReader & fi @@ -2355,7 +2358,6 @@ EOF download "https://iamtalon.me/games/rtr_ultimate.zip" unzip -d "$WINEPREFIX/drive_c/Program Files" "${cache}/rtr_ultimate.zip" add_launcher "c:\Program Files\rtr_Ultimate\trtr.exe" - echo "To get speech in this game please run speak_window_title.sh in the speech directory." ;; "Road to Rage Offline") export winVer="win7" diff --git a/speech/speak_window_title.sh b/speech/speak_window_title.sh index 87d1101..4e8f9f1 100755 --- a/speech/speak_window_title.sh +++ b/speech/speak_window_title.sh @@ -2,7 +2,13 @@ # Adapted from the bash snippet found at: # https://bbs.archlinux.org/viewtopic.php?id=117031 -while : ; do +# Wait for the application to start +while ! pgrep -u "$USER" ^$1 &> /dev/null ; do + sleep 0.05 +done + +# Read so long as the application is running +while pgrep -u "$USER" ^$1 &> /dev/null ; do wnd_focus=$(xdotool getwindowfocus) wnd_title=$(xprop -id $wnd_focus WM_NAME) lookfor='"(.*)"'