Added yad dialogues if in GUI session, retains the dialog interface if in console.

This commit is contained in:
Storm Dragon
2025-08-01 15:25:53 -04:00
parent 15f90a7979
commit 76f0c66c96
16 changed files with 392 additions and 113 deletions

View File

@ -39,11 +39,7 @@ game_installer() {
menuList+=("Donate" "Donate")
menuList+=("Become a Patron" "Become a Patron")
# Show game selection dialog
game="$(dialog --backtitle "Audio Game Installer" \
--clear \
--ok-label "Install" \
--no-tags \
--menu "Please select a game to install" 0 0 0 "${menuList[@]}" --stdout)"
game="$(agm_menu "Audio Game Installer" "Audio Game Installer" "Please select a game to install" "${menuList[@]}")"
[[ $? -ne 0 ]] && exit 0
# Handle selection
if [[ -n "$game" ]]; then
@ -64,8 +60,7 @@ game_installer() {
# Source and execute the install script
source "$installScript"
else
dialog --backtitle "Audio Game Installer" \
--msgbox "Installation script not found for ${game}" -1 -1
agm_msgbox "Audio Game Installer" "Audio Game Installer" "Installation script not found for ${game}"
exit 1
fi
;;
@ -95,11 +90,7 @@ game_removal() {
menuList+=("Donate" "Donate")
menuList+=("Become a Patron" "Become a Patron")
local game
game="$(dialog --backtitle "Audio Game Removal" \
--clear \
--ok-label "Remove" \
--no-tags \
--menu "Please select a game to delete" 0 0 0 "${menuList[@]}" --stdout)"
game="$(agm_menu "Audio Game Removal" "Audio Game Removal" "Please select a game to delete" "${menuList[@]}")"
if [[ ${#game} -gt 0 ]]; then
if [[ "$game" == "Donate" ]]; then
open_url "https://ko-fi.com/stormux"
@ -155,11 +146,7 @@ kill_game() {
done
menuList+=("Donate" "Donate")
menuList+=("Become a Patron" "Become a Patron")
local game="$(dialog --backtitle "Audio Game Killer" \
--clear \
--ok-label "Kill" \
--no-tags \
--menu "Please select a game to force stop" 0 0 0 "${menuList[@]}" --stdout)"
local game="$(agm_menu "Audio Game Killer" "Audio Game Killer" "Please select a game to force stop" "${menuList[@]}")"
if [[ ${#game} -gt 0 ]]; then
if [[ "$game" == "Donate" ]]; then
open_url "https://ko-fi.com/stormux"
@ -319,13 +306,7 @@ game_launcher() {
menuList+=("Donate" "Donate")
menuList+=("Become a Patron" "Become a Patron")
local game=""
game="$(dialog --backtitle "Audio Game Launcher" \
--clear \
--extra-button \
--extra-label "Documentation" \
--ok-label "Launch" \
--no-tags \
--menu "Please select a game to play" 0 0 0 "${menuList[@]}" --stdout)"
game="$(agm_menu "Audio Game Launcher" "Audio Game Launcher" "Please select a game to play" "${menuList[@]}")"
local menuCode=$?
if [[ $menuCode -eq 1 ]] || [[ $menuCode -eq 255 ]]; then
exit 0
@ -387,6 +368,14 @@ game_launcher() {
trap "exit 0" SIGINT
# Detect dialog interface type BEFORE potentially setting DISPLAY
# This must happen before we modify DISPLAY to preserve console detection
if [[ -z "$DISPLAY" ]]; then
dialogType="dialog"
else
dialogType="yad"
fi
# 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"
@ -431,6 +420,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
source .includes/functions.sh
source .includes/help.sh
source .includes/update.sh
@ -502,8 +492,7 @@ while getopts "${args}" i ; do
S) defaultRate="${OPTARG}";;
t)
gameCount=$(find ".install" -type f -iname "*.sh" | wc -l)
dialog --backtitle "Linux Game Manager" \
--infobox "There are currently ${gameCount} games available." -1 -1
agm_infobox "Linux Game Manager" "Linux Game Manager" "There are currently ${gameCount} games available."
exit 0
;;
v) voiceName="${OPTARG}";;