diff --git a/.install/Axel Pong.sh b/.install/Axel Pong.sh new file mode 100644 index 0000000..adab859 --- /dev/null +++ b/.install/Axel Pong.sh @@ -0,0 +1,4 @@ +download "https://axelek.pl/index/axel_pong.7z" +install_wine_bottle +install_with_progress 7z "Extracting game files..." x -o"$WINEPREFIX/drive_c/Program Files/Axel Pong" "${cache}/axel_pong.7z" +add_launcher "c:\Program Files\Axel Pong\axel_pong.exe" diff --git a/audiogame-manager.sh b/audiogame-manager.sh index b8fcc5f..268a519 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -343,6 +343,9 @@ custom_launch_parameters() { if [[ "${game[2]}" == "Road to Rage" ]]; then "${scriptDir}/speech/speak_window_title.sh" trtr.exe & fi + if [[ "${game[2]}" == "Axel Pong" ]]; then + "${scriptDir}/speech/speak_window_title.sh" axel_pong.exe & + fi if [[ "${game[2]}" == "Sequence Storm" ]]; then "${scriptDir}/speech/clipboard_reader.sh" SequenceStorm & fi diff --git a/speech/speak_window_title.sh b/speech/speak_window_title.sh index 3fbd4a1..b045459 100755 --- a/speech/speak_window_title.sh +++ b/speech/speak_window_title.sh @@ -1,28 +1,49 @@ #!/usr/bin/env bash # Adapted from the bash snippet found at: # https://bbs.archlinux.org/viewtopic.php?id=117031 - + +# Get window title, handling Wine virtual desktop child windows +get_window_title() { + local exeName="$1" + local wndFocus wndTitle + + wndFocus=$(xdotool getwindowfocus) + wndTitle=$(xprop -id "$wndFocus" WM_NAME 2>/dev/null) + + # Check if we're focused on Wine Desktop + if [[ "$wndTitle" == *"Wine Desktop"* ]]; then + # Look for child window belonging to our executable + wndTitle=$(xwininfo -tree -root 2>/dev/null | grep -i "\"$exeName\"" | head -1) + # Extract the window title from xwininfo output (format: 0xID "Title": ("class" "class")) + if [[ "$wndTitle" =~ \"([^\"]+)\":\ \(\"$exeName\" ]]; then + echo "${BASH_REMATCH[1]}" + return + fi + fi + + # Standard case - extract title from xprop output + if [[ "$wndTitle" =~ \"(.*)\" ]]; then + echo "${BASH_REMATCH[1]}" + fi +} + # Wait for the application to start -while ! pgrep -u "$USER" ^$1 &> /dev/null ; do +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 +while pgrep -u "$USER" "^$1" &> /dev/null ; do sleep 0.05 if [[ -f ~/.agmsilent ]]; then continue fi - wnd_focus=$(xdotool getwindowfocus) - wnd_title=$(xprop -id $wnd_focus WM_NAME) - lookfor='"(.*)"' - - if [[ "$wnd_title" =~ $lookfor ]]; then - wnd_title=${BASH_REMATCH[1]} - if [[ "$oldTitle" != "$wnd_title" ]]; then - spd-say -- "$wnd_title" - oldTitle="$wnd_title" - fi + + wndTitle=$(get_window_title "$1") + + if [[ -n "$wndTitle" ]] && [[ "$oldTitle" != "$wndTitle" ]]; then + spd-say -- "$wndTitle" + oldTitle="$wndTitle" fi done