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" local text="$3"
if [[ "$dialogType" == "yad" ]]; then if [[ "$dialogType" == "yad" ]]; then
yad --form \ echo -e "$text" | yad --text-info \
--title="$title" \ --title="$title" \
--field="$text:LBL" \ --show-cursor \
--selectable-labels \
--button="OK:0" \ --button="OK:0" \
--width=400 --width=600 \
--height=400
else else
dialog --backtitle "$backTitle" \ dialog --backtitle "$backTitle" \
--title "$title" \ --title "$title" \
@@ -186,13 +186,13 @@ agm_yesno() {
local text="$3" local text="$3"
if [[ "$dialogType" == "yad" ]]; then if [[ "$dialogType" == "yad" ]]; then
yad --form \ echo -e "$text" | yad --text-info \
--title="$title" \ --title="$title" \
--field="$text:LBL" \ --show-cursor \
--selectable-labels \
--button="Yes:0" \ --button="Yes:0" \
--button="No:1" \ --button="No:1" \
--width=400 --width=600 \
--height=400
else else
dialog --backtitle "$backTitle" \ dialog --backtitle "$backTitle" \
--title "$title" \ --title "$title" \
@@ -361,8 +361,36 @@ agm_progress_with_percent() {
local text="$2" local text="$2"
if [[ "$dialogType" == "yad" ]]; then if [[ "$dialogType" == "yad" ]]; then
# Create a true progress dialog that accepts percentage updates # Start audio feedback for accessibility
yad --progress \ 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" \ --title="$title" \
--text="$text" \ --text="$text" \
--auto-close \ --auto-close \

View File

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

View File

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