From ea56ce95d47cc7fb963191095ee5c1ac0114da11 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Tue, 3 Nov 2026 14:31:55 -0500 Subject: [PATCH] Launch audiogame-manager with the -u flag for a ui to access any of its usage flags, e.g. play, install, remove. --- .includes/desktop.sh | 4 +++- .includes/dialog-interface.sh | 4 ++-- README.md | 8 ++++++++ audiogame-manager.sh | 17 +++++++++++++++++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.includes/desktop.sh b/.includes/desktop.sh index b881de2..50542a8 100644 --- a/.includes/desktop.sh +++ b/.includes/desktop.sh @@ -1,3 +1,5 @@ +# shellcheck shell=bash + # Create desktop launcher file desktop_launcher() { local desktopFile="${HOME}/audiogame-manager.desktop" @@ -18,7 +20,7 @@ desktop_launcher() { 'Name=Audiogame manager' 'GenericName=Audiogame Manager' 'Comment=Play audio games' - "Exec=${terminal} -t \"Audiogame Manager\" -e \"/usr/bin/bash -c 'nohup $(readlink -e "$0") 2> /dev/null'\"" + "Exec=${terminal} -t \"Audiogame Manager\" -e \"/usr/bin/bash -c 'nohup $(readlink -e "$0") -u 2> /dev/null'\"" 'Terminal=false' 'Type=Application' 'StartupNotify=false' diff --git a/.includes/dialog-interface.sh b/.includes/dialog-interface.sh index dd2e80a..a1bc1e1 100644 --- a/.includes/dialog-interface.sh +++ b/.includes/dialog-interface.sh @@ -49,7 +49,7 @@ agm_menu() { --selectable-labels \ --search-column=1 \ --height=400 \ - --width=600) + --width=600) || return $? # Strip trailing pipes and return the mapped value if [[ -n "$selectedDescription" ]]; then @@ -74,7 +74,7 @@ agm_menu() { --no-tags \ --menu "$text" 0 0 0 \ "${dialogArgs[@]}" \ - --stdout) + --stdout) || return $? # Return the mapped value if [[ -n "$selectedDescription" ]]; then diff --git a/README.md b/README.md index d3b600b..23c0802 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,14 @@ Get usage instructions. Select from a list of games to install. + ./audiogame-manager.sh -u + +Choose **Play**, **Install**, **Remove**, or **Force Stop**, then select a game +in the corresponding menu. This uses Yad when a display and Yad are available, +or console dialog otherwise. Cancel closes the action menu without starting an +action. Desktop shortcuts created with `-D` now open this menu; recreate existing +shortcuts with `-D` to use it. + With no arguments, the list of installed games will be displayed. In all the menus, both installer and launcher, use the up and down arrow keys to find the game you want. Press enter on the game to perform the action. For more detailed help, try the -h flag. Use `./audiogame-manager.sh -s` to open the launcher without automatically diff --git a/audiogame-manager.sh b/audiogame-manager.sh index 89a1769..51b71af 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -359,6 +359,21 @@ ensure_wine_bottles() { } +# Choose a manager action using the current console or graphical interface. +action_menu() { + local selectedAction + selectedAction="$(agm_menu "Audiogame Manager" "Audiogame Manager" \ + "Please select an action" \ + play "Play" install "Install" remove "Remove" stop "Force Stop")" || return 0 + + case "$selectedAction" in + play) game_launcher;; + install) game_installer;; + remove) game_removal;; + stop) kill_game;; + esac +} + # Install games game_installer() { export LANG="en_US.UTF-8" @@ -1020,6 +1035,7 @@ declare -A command=( [S:]="Speech rate. Requires -V voice name, the default is 7. Values 0-9 or A." [s]="Skip automatic NVDA controller DLL replacement when launching games." [t]="Total games. Show how many games are currently available." + [u]="Choose Play, Install, Remove, or Force Stop from a menu." [v:]="Select the voice to be installed, default is Bdl. Options are alan, bdl, clb, or slt." [V:]="Select the default voice for a bottle." ) @@ -1089,6 +1105,7 @@ while getopts "${args}" i ; do agm_infobox "Linux Game Manager" "Linux Game Manager" "There are currently ${gameCount} games available." exit 0 ;; + u) action_menu; exit $?;; v) # shellcheck disable=SC2034 voiceName="${OPTARG}"