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 logs_folder=/home/deck/retrodeck/.logs
sdcard=/run/media/mmcblk0p1 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() { desktop_mode_warning() {
# This function is a generic warning for issues that happen when running in desktop mode. # 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 \ if [[ ! $XDG_CURRENT_DESKTOP == "gamescope" ]]; then
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ if [[ $desktop_mode_warning == "true" ]]; then
--title "RetroDECK Desktop Mode Warning" \ choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="Yes" --extra-button="No" --extra-button="Never show this again" \
--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!" --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() { set_setting_value() {

View file

@ -135,11 +135,9 @@ else
finit # Executing First/Force init finit # Executing First/Force init
fi 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
desktop_mode_warning
fi
# Normal Startup # Normal Startup

View file

@ -197,95 +197,95 @@ configurator_retroachivement_dialog() {
} }
configurator_power_user_warning_dialog() { configurator_power_user_warning_dialog() {
zenity --title "RetroDECK Configurator Utility - Power User Options" --question --no-wrap --cancel-label="Back" \ if [[ $power_user_warning == "true" ]]; then
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="Yes" --extra-button="No" --extra-button="Never show this again" \
--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." --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Desktop Mode Warning" \
if [ $? == 0 ]; then # OK button clicked --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?")
power_user="true" fi
set_setting_value $rd_conf "power_user" "$power_user" retrodeck # Store power user variable for future checks 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 fi
} }
configurator_power_user_changes_dialog() { configurator_power_user_changes_dialog() {
if [[ $power_user == "true" ]]; then emulator=$(zenity --list \
emulator=$(zenity --list \ --title "RetroDECK Configurator Utility - Power User Options" --cancel-label="Back" \
--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 \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \ --text="Which emulator do you want to configure?" \
--text="Which emulator do you want to configure?" \ --hide-header \
--hide-header \ --column=emulator \
--column=emulator \ "RetroArch" \
"RetroArch" \ "Citra" \
"Citra" \ "Dolphin" \
"Dolphin" \ "Duckstation" \
"Duckstation" \ "MelonDS" \
"MelonDS" \ "PCSX2" \
"PCSX2" \ "PPSSPP" \
"PPSSPP" \ "Primehack" \
"Primehack" \ "RPCS3" \
"RPCS3" \ "XEMU" \
"XEMU" \ "Yuzu")
"Yuzu")
case $emulator in case $emulator in
"RetroArch" ) "RetroArch" )
retroarch retroarch
;; ;;
"Citra" ) "Citra" )
citra-qt citra-qt
;; ;;
"Dolphin" ) "Dolphin" )
dolphin-emu dolphin-emu
;; ;;
"Duckstation" ) "Duckstation" )
duckstation-qt duckstation-qt
;; ;;
"MelonDS" ) "MelonDS" )
melonDS melonDS
;; ;;
"PCSX2" ) "PCSX2" )
pcsx2-qt pcsx2-qt
;; ;;
"PPSSPP" ) "PPSSPP" )
PPSSPPSDL PPSSPPSDL
;; ;;
"Primehack" ) "Primehack" )
primehack-wrapper primehack-wrapper
;; ;;
"RPCS3" ) "RPCS3" )
rpcs3 rpcs3
;; ;;
"XEMU" ) "XEMU" )
xemu xemu
;; ;;
"Yuzu" ) "Yuzu" )
yuzu yuzu
;; ;;
"" ) # No selection made or Back button clicked "" ) # No selection made or Back button clicked
configurator_welcome_dialog configurator_welcome_dialog
;; ;;
esac esac
else
configurator_power_user_warning_dialog
if [[ $power_user == "true" ]]; then
configurator_power_user_changes_dialog
else
configurator_welcome_dialog
fi
fi
} }
configurator_retroarch_rewind_dialog() { configurator_retroarch_rewind_dialog() {
@ -651,7 +651,7 @@ configurator_welcome_dialog() {
;; ;;
"Change Standalone Emulator Options" ) "Change Standalone Emulator Options" )
configurator_power_user_changes_dialog configurator_power_user_warning_dialog
;; ;;
"Compress Games" ) "Compress Games" )