From d49ca8a86bbfb46da1c88b93b18c1bb6df6cfd8f Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Tue, 5 Aug 2025 01:40:27 -0400 Subject: [PATCH] Hopefully insure people using the GUI mode with audiogame-manager do not get stuck because some messages were only appearing in the terminal which may not be present at all in the GUI. --- .includes/functions.sh | 19 +++++++------------ audiogame-manager.sh | 18 +++++++++++------- game-scripts/mist_world_account_creator.sh | 13 +++++++++++-- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/.includes/functions.sh b/.includes/functions.sh index 435651a..a9d0d40 100644 --- a/.includes/functions.sh +++ b/.includes/functions.sh @@ -2,7 +2,7 @@ alert() { play -qnV0 synth 3 pluck D3 pluck A3 pluck D4 pluck F4 pluck A4 delay 0 .1 .2 .3 .4 remix - chorus 0.9 0.9 38 0.75 0.3 0.5 -t echo - read -rp "Press enter to continue." continue + agm_msgbox "Alert" "" "Press OK to continue." } check_requirements() { @@ -23,23 +23,18 @@ check_requirements() { } clear_cache() { - local answer if [[ ! -d "${cache}" ]]; then - echo "No cache found at ${cache}." + agm_msgbox "Clear Cache" "" "No cache found at ${cache}." return fi - while ! [[ "${answer,,}" =~ ^yes$|^no$ ]]; do - echo "This will delete all contents of ${cache}. Are you sure you want to continue?" - echo "Please type yes or no." - echo - read -r answer - done - if [[ "$answer" == "no" ]]; then + + if ! agm_yesno "Clear Cache" "" "This will delete all contents of ${cache}. Are you sure you want to continue?"; then return fi + # All safety checks done. Delete the cache. - rm -rfv "${cache}" - echo "Cache deleted." + rm -rfv "${cache}" | agm_progressbox "Clear Cache" "Deleting cache files..." + agm_msgbox "Clear Cache" "" "Cache deleted." } download() { diff --git a/audiogame-manager.sh b/audiogame-manager.sh index 576a2cc..ce219d3 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -108,7 +108,10 @@ game_removal() { source .includes/bottle.sh get_bottle "${game[0]}" - read -rp "This will remove the game files for \"${game[2]}\" from the shared wine bottle. To continue press enter. To cancel press control+c. " continue + if ! agm_yesno "Confirm Removal" "Audio Game Removal" "Are you sure you want to remove \"${game[2]}\"?"; then + echo "Removal cancelled." + exit 0 + fi # kill any previous existing wineservers for this prefix in case they didn't shut down properly. wineserver -k @@ -117,10 +120,9 @@ game_removal() { if [[ -n "$winePath" ]]; then local gameDir="$(winepath "$winePath")" if [[ -d "$gameDir" ]]; then - echo "Removing game directory: $gameDir" - rm -rf "$gameDir" + rm -rfv "$gameDir" | agm_progressbox "Removing Game" "Removing \"${game[2]}\" files..." else - echo "Game directory not found, skipping file removal." + agm_msgbox "Game Removal" "" "Game directory not found, skipping file removal." fi fi fi @@ -368,6 +370,9 @@ else dialogType="yad" fi +# Source dialog interface early for progress display +source .includes/dialog-interface.sh + # If display isn't set assume we are launching from console and an X environment is running using display :0 if [[ -z "$DISPLAY" ]]; then export DISPLAY=":0" @@ -388,8 +393,7 @@ fi # Update the cache for older versions of audiogame-manager if [[ -d "${configFile%/*}/cache" ]]; then { mv -v "${configFile%/*}/cache/"* "${cache}" - rmdir -v "${configFile%/*}/cache/"; } | dialog \ - --backtitle "Audiogame Manager" --progressbox "Updating cache, please wait..." -1 -1 + rmdir -v "${configFile%/*}/cache/"; } | agm_progressbox "Audiogame Manager" "Updating cache, please wait..." fi checkWinetricksUpdate="false" # Turn off debug messages @@ -420,7 +424,7 @@ export nvdaControllerClientDll="${ipfsGateway}/ipfs/QmWu7YdSbKMk1Qm5DKvEA5hk1YuA # Source helper functions source .includes/bottle.sh # Also sourced in functions that need it source .includes/desktop.sh -source .includes/dialog-interface.sh +# dialog-interface.sh already sourced earlier source .includes/functions.sh source .includes/help.sh source .includes/update.sh diff --git a/game-scripts/mist_world_account_creator.sh b/game-scripts/mist_world_account_creator.sh index 3fb1f99..370b5de 100755 --- a/game-scripts/mist_world_account_creator.sh +++ b/game-scripts/mist_world_account_creator.sh @@ -2,8 +2,17 @@ export DISPLAY="${DISPLAY:-:0}" -read -rp "Select create account from the menu, press enter to continue." continue -echo +# Source dialog interface for cross-platform compatibility +source "${0%/*}/../.includes/dialog-interface.sh" + +# Detect dialog interface type +if [[ -z "$DISPLAY" ]]; then + dialogType="dialog" +else + dialogType="yad" +fi + +agm_msgbox "Mist World Account Creator" "" "Select create account from the menu, then press OK to continue." # Read email address echo "Enter email address:"