diff --git a/audiogame-manager.sh b/audiogame-manager.sh index d27df2d..1bf176c 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -775,6 +775,9 @@ game_launcher() { if [[ "$game" =~ laser-breakout ]]; then pgrep -u "$USER" nvda2speechd &> /dev/null || ${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd & fi + if [[ "$game" =~ ^bokurano-daibouken\||bokurano-daibouken-2\| ]]; then + "${0%/*}/speech/clipboard_translator.sh" play.exe & + fi if [[ "$game" =~ bokurano-daibouken-3 ]]; then pgrep -u "$USER" nvda2speechd &> /dev/null || ${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd & dictPath="$(winepath "${winePath}")" diff --git a/speech/clipboard_translator.sh b/speech/clipboard_translator.sh index c5c9b20..0aaadb2 100755 --- a/speech/clipboard_translator.sh +++ b/speech/clipboard_translator.sh @@ -12,7 +12,18 @@ export dictionaryFile="${XDG_CONFIG_HOME:-$HOME/.config}/storm-games/audiogame-m if [[ ! -r "$dictionaryFile" ]]; then touch "$dictionaryFile" fi -while : ; do + +if [[ $# -ne 1 ]]; then + echo "Usage: $0 application name." +fi + +# 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 newText="" translatedText="" newText="$(xclip -d "${DISPLAY:-:0}" -selection clipboard -o 2> /dev/null)"