More improvements to progress bars. Hopefully fixed a bug that was causing games to install twice.

This commit is contained in:
Storm Dragon
2025-08-06 00:39:17 -04:00
parent 6351d88676
commit 27f9e973a3
2 changed files with 37 additions and 43 deletions

View File

@@ -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