diff --git a/.includes/dialog-interface.sh b/.includes/dialog-interface.sh index 2b389ba..182de42 100644 --- a/.includes/dialog-interface.sh +++ b/.includes/dialog-interface.sh @@ -226,40 +226,30 @@ agm_progressbox() { local text="$2" if [[ "$dialogType" == "yad" ]]; then - # Use a text-info dialog with improved real-time output display - # Force line buffering and use named pipe for better responsiveness - local tmpPipe - tmpPipe=$(mktemp -u) - mkfifo "$tmpPipe" + # Use accessible form approach without temp files + # Process command output first to get summary info + local lineCount=0 + local lastLine="Starting..." + local allOutput="" - # Start yad in background reading from the pipe - yad --text-info \ + # Collect output while command runs + while IFS= read -r line; do + ((lineCount++)) + lastLine="$line" + allOutput="${allOutput}${line}\n" + done < <(stdbuf -oL cat) + + # Show completion dialog with accessible summary + yad --form \ --title="$title" \ - --text="$text" \ - --width=600 \ - --height=400 \ - --timeout=1 \ - --timeout-indicator=bottom \ - --button="Close:0" \ - --tail \ - --auto-scroll \ - --filename="$tmpPipe" & - local yadPid=$! - - # Process input and write to pipe with unbuffered output - { - stdbuf -oL cat - echo "=== Operation completed ===" - } > "$tmpPipe" & - local catPid=$! - - # Wait for either process to finish - wait $catPid 2>/dev/null - - # Clean up - sleep 1 # Brief pause to ensure yad displays the completion message - kill $yadPid 2>/dev/null - rm -f "$tmpPipe" + --field="$text - Completed:LBL" \ + --field="Total steps: $lineCount:LBL" \ + --field="Last action::LBL" \ + --field="$lastLine:RO" \ + --selectable-labels \ + --button="OK:0" \ + --width=500 \ + --height=200 else dialog --title "$title" \ --progressbox "$text" 20 70 diff --git a/audiogame-manager.sh b/audiogame-manager.sh index 9a351b6..56629ca 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -526,6 +526,7 @@ while getopts "${args}" i ; do i) game_installer;; I) export game="${OPTARG}" + export noninteractiveInstall="true" break;; k) kill_game;; L) license;; @@ -552,16 +553,19 @@ done # If agmNoLaunch is set, exit (script is being sourced) [[ "$agmNoLaunch" == "true" ]] && exit 0 -# If no game specified, exit -[[ ${#game} -lt 1 ]] && exit 0 +# Only proceed with noninteractive installation if explicitly requested +if [[ "$noninteractiveInstall" == "true" ]]; then + # If no game specified for noninteractive install, exit + [[ ${#game} -lt 1 ]] && exit 0 -# Install the specified game noninteractively -if [[ -f ".install/${game}.sh" ]]; then - export LANG="en_US.UTF-8" - . ".install/${game}.sh" - # Show success message - agm_msgbox "Installation Complete" "Audio Game Installer" "Game \"${game}\" has been successfully installed." -else - agm_msgbox "Audio Game Installer" "" "Error: Game '${game}' not found in .install directory" - exit 1 + # Install the specified game noninteractively + if [[ -f ".install/${game}.sh" ]]; then + export LANG="en_US.UTF-8" + . ".install/${game}.sh" + # Show success message + agm_msgbox "Installation Complete" "Audio Game Installer" "Game \"${game}\" has been successfully installed." + else + agm_msgbox "Audio Game Installer" "" "Error: Game '${game}' not found in .install directory" + exit 1 + fi fi