Ported over ui updates from Linux Game Manager.

This commit is contained in:
Storm Dragon
2025-08-06 15:47:59 -04:00
parent adfef6fba4
commit fa80331a63
3 changed files with 51 additions and 14 deletions

View File

@@ -165,12 +165,12 @@ agm_msgbox() {
local text="$3"
if [[ "$dialogType" == "yad" ]]; then
yad --form \
echo -e "$text" | yad --text-info \
--title="$title" \
--field="$text:LBL" \
--selectable-labels \
--show-cursor \
--button="OK:0" \
--width=400
--width=600 \
--height=400
else
dialog --backtitle "$backTitle" \
--title "$title" \
@@ -186,13 +186,13 @@ agm_yesno() {
local text="$3"
if [[ "$dialogType" == "yad" ]]; then
yad --form \
echo -e "$text" | yad --text-info \
--title="$title" \
--field="$text:LBL" \
--selectable-labels \
--show-cursor \
--button="Yes:0" \
--button="No:1" \
--width=400
--width=600 \
--height=400
else
dialog --backtitle "$backTitle" \
--title "$title" \
@@ -361,8 +361,36 @@ agm_progress_with_percent() {
local text="$2"
if [[ "$dialogType" == "yad" ]]; then
# Create a true progress dialog that accepts percentage updates
yad --progress \
# Start audio feedback for accessibility
local beepPid
local yadPid
# Cleanup function for traps
cleanup_percent_progress() {
[[ -n "$beepPid" ]] && kill "$beepPid" 2>/dev/null
[[ -n "$yadPid" ]] && kill "$yadPid" 2>/dev/null
}
# Set trap to ensure cleanup on interruption
trap cleanup_percent_progress EXIT INT TERM
if command -v sox >/dev/null 2>&1; then
{
while true; do
# Generate a short, pleasant progress beep (440Hz for 0.1s)
sox -q -n -d synth 0.1 sine 440 vol 0.3 2>/dev/null
sleep 2 # Beep every 2 seconds
done
} &
beepPid=$!
fi
# Create a true progress dialog that accepts percentage updates with tee for cleanup
{
cat
cleanup_percent_progress
trap - EXIT INT TERM
} | yad --progress \
--title="$title" \
--text="$text" \
--auto-close \

View File

@@ -54,9 +54,16 @@ download() {
# Skip if the item is in cache.
[[ -e "${cache}/${dest}" ]] && continue
if [[ "$dialogType" == "yad" ]]; then
# Use curl's progress bar with better accessibility for yad
if ! curl -L4 -C - --retry 10 --progress-bar --output "${cache}/${dest}" "${i}" 2>&1 | \
sed -u 's/.*\r\([0-9]*\)%.*/\1/' | agm_progress_with_percent "Audio Game Manager" "Downloading \"$dest\"..."; then
# Use curl's progress bar with better parsing for yad
if ! {
curl -L4 -C - --retry 10 --progress-bar --output "${cache}/${dest}" "${i}" 2>&1 | \
stdbuf -oL grep -o '[0-9]*%' | \
stdbuf -oL sed -u 's/%$//' | \
while read -r percent; do
echo "$percent"
echo "# Downloading $dest - ${percent}%"
done
} | agm_progress_with_percent "Audio Game Manager" "Downloading \"$dest\"..."; then
agm_infobox "Audio Game Manager" "Audio Game Manager" "Could not download \"$dest\". Installation cannot continue."
exit 1
fi

View File

@@ -1,3 +1,5 @@
#!/usr/bin/env bash
# Check for latest news
check_news() {
# For use by update scripts that want to source functions in this file.
@@ -45,7 +47,7 @@ fi
# Get the important information: commit messages and summary
local changesSummary
changesSummary=$({
echo "=== UPDATE COMPLETED ==="
echo "UPDATE COMPLETED"
echo
echo "Recent changes:"
git log '@{1}..' --pretty=format:'• %an: %s' | tac