Rework power user and desktop mode warnings

This commit is contained in:
icenine451 2023-03-13 10:09:01 -04:00
parent a63654e245
commit b0df2e8dda
4 changed files with 94 additions and 82 deletions

View file

@ -9,4 +9,5 @@ themes_folder=/home/deck/retrodeck/themes
logs_folder=/home/deck/retrodeck/.logs
sdcard=/run/media/mmcblk0p1
power_user=false
power_user_warning=true
desktop_mode_warning=true

View file

@ -166,12 +166,25 @@ validate_for_chd () {
desktop_mode_warning() {
# This function is a generic warning for issues that happen when running in desktop mode.
# Running in desktop mode can be verified with the following command: if [[ $XDG_CURRENT_DESKTOP == "KDE" ]]; then
# Running in desktop mode can be verified with the following command: if [[ ! $XDG_CURRENT_DESKTOP == "gamescope" ]]; then
# This function will check if desktop mode is currently being used and if the warning has not been disabled, and show it if needed.
zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Desktop Mode Warning" \
--text="You appear to be running RetroDECK in the Steam Deck's Desktop mode!\n\nSome functions of RetroDECK may not work properly in Desktop mode, such as the Steam Deck's normal controls.\n\nRetroDECK is best enjoyed in Game mode!"
if [[ ! $XDG_CURRENT_DESKTOP == "gamescope" ]]; then
if [[ $desktop_mode_warning == "true" ]]; then
choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="Yes" --extra-button="No" --extra-button="Never show this again" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Desktop Mode Warning" \
--text="You appear to be running RetroDECK in the Steam Deck's Desktop mode!\n\nSome functions of RetroDECK may not work properly in Desktop mode, such as the Steam Deck's normal controls.\n\nRetroDECK is best enjoyed in Game mode!\n\nDo you still want to proceed?")
fi
fi
rc=$? # Capture return code, as "Yes" button has no text value
if [[ $rc == "1" ]]; then # If any button other than "Yes" was clicked
if [[ $choice == "No" ]]; then
exit 1
elif [[ $choice == "Never show this again" ]]; then
set_setting_value $rd_conf "desktop_mode_warning" "false" retrodeck # Store desktop mode warning variable for future checks
fi
fi
}
set_setting_value() {

View file

@ -135,11 +135,9 @@ else
finit # Executing First/Force init
fi
# Check if running in Desktop mode and warn if true
# Check if running in Desktop mode and warn if true, unless desktop_mode_warning=false in retrodeck.cfg
if [[ $XDG_CURRENT_DESKTOP == "KDE" ]]; then
desktop_mode_warning
fi
desktop_mode_warning
# Normal Startup

View file

@ -197,95 +197,95 @@ configurator_retroachivement_dialog() {
}
configurator_power_user_warning_dialog() {
zenity --title "RetroDECK Configurator Utility - Power User Options" --question --no-wrap --cancel-label="Back" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--text="Making manual changes to an emulators configuration may create serious issues,\nand some settings may be overwitten during RetroDECK updates.\n\nSome standalone emulator functions may not work properly outside of Desktop mode.\n\nPlease continue only if you know what you're doing.\n\nDo you want to continue?\n\nClicking Yes will set you as a Power User and you will not see this dialog again."
if [ $? == 0 ]; then # OK button clicked
power_user="true"
set_setting_value $rd_conf "power_user" "$power_user" retrodeck # Store power user variable for future checks
if [[ $power_user_warning == "true" ]]; then
choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="Yes" --extra-button="No" --extra-button="Never show this again" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Desktop Mode Warning" \
--text="Making manual changes to an emulators configuration may create serious issues,\nand some settings may be overwitten during RetroDECK updates.\n\nSome standalone emulator functions may not work properly outside of Desktop mode.\n\nPlease continue only if you know what you're doing.\n\nDo you want to continue?")
fi
rc=$? # Capture return code, as "Yes" button has no text value
if [[ $rc == "0" ]]; then # If user clicked "Yes"
configurator_power_user_changes_dialog
else # If any button other than "Yes" was clicked
if [[ $choice == "No" ]]; then
configurator_welcome_dialog
elif [[ $choice == "Never show this again" ]]; then
set_setting_value $rd_conf "power_user_warning" "false" retrodeck # Store desktop mode warning variable for future checks
configurator_power_user_changes_dialog
fi
fi
}
configurator_power_user_changes_dialog() {
if [[ $power_user == "true" ]]; then
emulator=$(zenity --list \
--title "RetroDECK Configurator Utility - Power User Options" --cancel-label="Back" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \
--text="Which emulator do you want to configure?" \
--hide-header \
--column=emulator \
"RetroArch" \
"Citra" \
"Dolphin" \
"Duckstation" \
"MelonDS" \
"PCSX2" \
"PPSSPP" \
"Primehack" \
"RPCS3" \
"XEMU" \
"Yuzu")
emulator=$(zenity --list \
--title "RetroDECK Configurator Utility - Power User Options" --cancel-label="Back" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \
--text="Which emulator do you want to configure?" \
--hide-header \
--column=emulator \
"RetroArch" \
"Citra" \
"Dolphin" \
"Duckstation" \
"MelonDS" \
"PCSX2" \
"PPSSPP" \
"Primehack" \
"RPCS3" \
"XEMU" \
"Yuzu")
case $emulator in
case $emulator in
"RetroArch" )
retroarch
;;
"RetroArch" )
retroarch
;;
"Citra" )
citra-qt
;;
"Citra" )
citra-qt
;;
"Dolphin" )
dolphin-emu
;;
"Dolphin" )
dolphin-emu
;;
"Duckstation" )
duckstation-qt
;;
"Duckstation" )
duckstation-qt
;;
"MelonDS" )
melonDS
;;
"MelonDS" )
melonDS
;;
"PCSX2" )
pcsx2-qt
;;
"PCSX2" )
pcsx2-qt
;;
"PPSSPP" )
PPSSPPSDL
;;
"PPSSPP" )
PPSSPPSDL
;;
"Primehack" )
primehack-wrapper
;;
"Primehack" )
primehack-wrapper
;;
"RPCS3" )
rpcs3
;;
"RPCS3" )
rpcs3
;;
"XEMU" )
xemu
;;
"XEMU" )
xemu
;;
"Yuzu" )
yuzu
;;
"Yuzu" )
yuzu
;;
"" ) # No selection made or Back button clicked
configurator_welcome_dialog
;;
"" ) # No selection made or Back button clicked
configurator_welcome_dialog
;;
esac
else
configurator_power_user_warning_dialog
if [[ $power_user == "true" ]]; then
configurator_power_user_changes_dialog
else
configurator_welcome_dialog
fi
fi
esac
}
configurator_retroarch_rewind_dialog() {
@ -651,7 +651,7 @@ configurator_welcome_dialog() {
;;
"Change Standalone Emulator Options" )
configurator_power_user_changes_dialog
configurator_power_user_warning_dialog
;;
"Compress Games" )