FRAMEWORK: making the framework aware if we are using zenity

This commit is contained in:
XargonWan 2025-02-18 11:11:50 +09:00
parent 45c5ff1ad0
commit acd5380410
5 changed files with 16 additions and 12 deletions

View file

@ -59,7 +59,7 @@ check_for_version_update() {
if [[ ! "$update_ignore" == "$online_version" ]]; then
if [[ "$update_repo" == "RetroDECK" ]] && [[ $(sed -e 's/[\.a-z]//g' <<< $version) -le $(sed -e 's/[\.a-z]//g' <<< $online_version) ]]; then
choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="OK" --extra-button="Ignore this version" \
choice=$(rd_zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="OK" --extra-button="Ignore this version" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK - New Update Available" \
--text="There is a new version of RetroDECK available: <span foreground='$blue'><b>$online_version</b></span>.\nYou can easily update from the app store you have installed, examples: KDE Discover or Gnome Software.\n\nIf you would like to ignore this notification, click the \"Ignore this version\" button.")

View file

@ -299,7 +299,9 @@ dir_prep() {
rd_zenity() {
# This function replaces the standard 'zenity' command and filters out annoying GTK errors on Steam Deck
export GUI="zenity"
zenity 2> >(grep -v 'Gtk' >&2) "$@"
unset GUI
}
update_rpcs3_firmware() {
@ -642,7 +644,7 @@ install_release() {
log d "Constructed flatpak URL: $flatpak_url"
# Confirm installation with the user
zenity --question --icon-name=net.retrodeck.retrodeck --no-wrap \
rd_zenity --question --icon-name=net.retrodeck.retrodeck --no-wrap \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Updater" \
--text="$1 will be now installed.\nThe update process may take several minutes.\n\nAfter the update is complete, RetroDECK will close. When you run it again, you will be using the latest version.\n\nDo you want to continue?"
@ -673,7 +675,7 @@ install_release() {
# Cleanup old bundles to save space
rm -rf "$rdhome/RetroDECK_Updates"
) |
zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \
rd_zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Updater" \
--text="RetroDECK is updating to the selected version, please wait."
@ -791,7 +793,7 @@ release_selector() {
while true; do
echo "# Fetching all available releases from GitHub repositories... Please wait. This may take some time." ; sleep 1
done
) | zenity --progress --title="Fetching Releases" --text="Fetching releases..." --pulsate --no-cancel --auto-close --width=500 --height=150 &
) | rd_zenity --progress --title="Fetching Releases" --text="Fetching releases..." --pulsate --no-cancel --auto-close --width=500 --height=150 &
progress_pid=$! # save process PID to kill it later
@ -931,7 +933,7 @@ quit_retrodeck() {
source /app/libexec/steam_sync.sh
add_to_steam "$(ls "$rdhome/ES-DE/gamelists/")"
) |
zenity --progress \
rd_zenity --progress \
--title="Syncing with Steam" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--text="<span foreground='$purple'><b>\t\t\t\tSyncing favorite games with Steam.</b></span>\n\n<b>NOTE: </b>This operation may take some time depending on the size of your library.\nFeel free to leave this in the background and switch to another application.\n\n" \

View file

@ -428,7 +428,7 @@ post_update() {
# Create a Zenity window with checkboxes for each reset option and two buttons
while true; do
choices=$(zenity --list --checklist --title="RetroDECK Reset Options" \
choices=$(rd_zenity --list --checklist --title="RetroDECK Reset Options" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--text="The following components have been updated and need to be reset or fixed to ensure compatibility with the new version: select the components you want to reset.\n\nNot resetting them may cause serious issues with your installation.\nYou can also reset them manually later via Configurator -> Troubleshooting -> Reset Component.\n\nNote: Your games, saves, game collections and scraped data will not be affected." \
--column="Select" --column="Component" --column="Description" --width="1100" --height="700" \
@ -456,7 +456,7 @@ post_update() {
fi
if [[ $? -eq 0 && -n "$choices" ]]; then
if ! zenity --question --title="Confirmation" --text="Are you sure you want to proceed with only the selected options?\n\nThis might cause issues in RetroDECK"; then
if ! rd_zenity --question --title="Confirmation" --text="Are you sure you want to proceed with only the selected options?\n\nThis might cause issues in RetroDECK"; then
log i "User is not sure, showing the checklist window again."
continue
else
@ -466,7 +466,7 @@ post_update() {
fi
if [[ $? == 0 ]]; then
if ! zenity --question --title="Confirmation" --text="Are you sure you want to skip the reset process?\n\nThis might cause issues in RetroDECK"; then
if ! rd_zenity --question --title="Confirmation" --text="Are you sure you want to skip the reset process?\n\nThis might cause issues in RetroDECK"; then
log i "User is not sure, showing the checklist window again."
continue
else
@ -563,7 +563,7 @@ post_update() {
# Create a Zenity window with checkboxes for each reset option and two buttons
while true; do
choices=$(zenity --list --checklist --title="RetroDECK Reset Options" \
choices=$(rd_zenity --list --checklist --title="RetroDECK Reset Options" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--text="The following components have been updated and need to be reset or fixed to ensure compatibility with the new version: select the components you want to reset.\n\nNot resetting them may cause serious issues with your installation.\nYou can also reset them manually later via Configurator -> Troubleshooting -> Reset Component.\n\nNote: Your games, saves, game collections and scraped data will not be affected." \
--column="Select" --column="Component" --column="Description" --width="1100" --height="700" \
@ -588,7 +588,7 @@ post_update() {
fi
if [[ $? -eq 0 && -n "$choices" ]]; then
if ! zenity --question --title="Confirmation" --text="Are you sure you want to proceed with only the selected options?\n\nThis might cause issues in RetroDECK"; then
if ! rd_zenity --question --title="Confirmation" --text="Are you sure you want to proceed with only the selected options?\n\nThis might cause issues in RetroDECK"; then
log i "User is not sure, showing the checklist window again."
continue
else
@ -598,7 +598,7 @@ post_update() {
fi
if [[ $? == 0 ]]; then
if ! zenity --question --title="Confirmation" --text="Are you sure you want to skip the reset process?\n\nThis might cause issues in RetroDECK"; then
if ! rd_zenity --question --title="Confirmation" --text="Are you sure you want to skip the reset process?\n\nThis might cause issues in RetroDECK"; then
log i "User is not sure, showing the checklist window again."
continue
else

View file

@ -178,7 +178,7 @@ find_system_commands() {
selected_command="${command_list[1]}"
else
# Show the list with Zenity and return the **command** (second column) selected
selected_command=$(zenity --list \
selected_command=$(rd_zenity --list \
--title="Select an emulator for $system_name" \
--column="Emulator" --column="Hidden Command" "${command_list[@]}" \
--width=800 --height=400 --print-column=2 --hide-column=2)

View file

@ -96,6 +96,7 @@ source /app/libexec/global.sh
configurator_welcome_dialog() {
log i "Configurator: opening welcome dialog"
export GUI="zenity"
welcome_menu_options=(
"Settings" "Customize your RetroDECK experience with various presets and tweaks."
"Open Component" "Manually launch and configure settings for each emulator or component (for advanced users)."
@ -159,6 +160,7 @@ configurator_welcome_dialog() {
"" )
log i "Configurator: closing"
unset GUI
exit 0
;;