From 7848f42799f605a8790f21ed79fcebd26590bc2a Mon Sep 17 00:00:00 2001 From: HikariKnight <2557889+HikariKnight@users.noreply.github.com> Date: Tue, 25 Jun 2024 16:59:53 +0200 Subject: [PATCH] feat: add firstboot warning to users with polaris gpus (#1277) Only triggers if `/usr/libexec/bazzite-sdl-gpu-warn` exists (only does on handheld images) also triggers on any gpus defined in `/usr/libexec/gamescope-sdl-workaround` --- .../shared/usr/libexec/bazzite-sdl-gpu-warn | 38 +++++++++++++++++++ .../ublue-os/firstboot/launcher/autostart.sh | 7 ++++ 2 files changed, 45 insertions(+) create mode 100755 system_files/deck/shared/usr/libexec/bazzite-sdl-gpu-warn diff --git a/system_files/deck/shared/usr/libexec/bazzite-sdl-gpu-warn b/system_files/deck/shared/usr/libexec/bazzite-sdl-gpu-warn new file mode 100755 index 00000000..5a579f34 --- /dev/null +++ b/system_files/deck/shared/usr/libexec/bazzite-sdl-gpu-warn @@ -0,0 +1,38 @@ +#!/usr/bin/bash + +# The file to use for tracking if the warning has been shown +ACCEPTED="$HOME/.config/bazzite/gamescope-sdl-accepted" + +# Check if the check has already run +if [ -f "$ACCEPTED" ]; then + # Exit if user has already aknowledged the warning + exit 0 +fi + +# Show the SDL workaround warning if required +if /usr/libexec/gamescope-sdl-workaround; then + # Add 4 spaces if you want to start a new line, + # it makes the text easier to read in the dialog. + zenity --text-info --title="WARNING: Problematic GPU detected!" --checkbox="Understood, I made sure to have a controller connected." --width 560 --height 430 <<< " + This GPU requires a workaround to work in Game Mode Session! + It is applied automatically, however it means that + keyboard and mouse will not work AT ALL when using + Game Mode Session (Desktop Mode will not be affected) + + Please pair at least 1 bluetooth controller to the system now + so you can navigate Steam Game Mode. + + If you plan to use a wired controller or one with a non + bluetooth dongle, verify it is detected in Steam BEFORE rebooting!" + + # If the user mark the checkbox and clicks OK + # shellcheck disable=SC2181 + if [ "$?" == "0" ]; then + # Make the .config/bazzite folder if needed + if [ ! -d "$HOME/.config/bazzite" ]; then + mkdir "$HOME/.config/bazzite/" + fi + # Mark that the user has acknowledged the warning + touch "$ACCEPTED" + fi +fi diff --git a/system_files/desktop/shared/usr/share/ublue-os/firstboot/launcher/autostart.sh b/system_files/desktop/shared/usr/share/ublue-os/firstboot/launcher/autostart.sh index 21abc168..76c8c4b2 100755 --- a/system_files/desktop/shared/usr/share/ublue-os/firstboot/launcher/autostart.sh +++ b/system_files/desktop/shared/usr/share/ublue-os/firstboot/launcher/autostart.sh @@ -1,4 +1,11 @@ #!/usr/bin/bash +# Show a warning to people that need gamescope-sdl-workaround +# Only runs if the script file from the deck image exists +if [ -f "/usr/libexec/bazzite-sdl-gpu-warn" ]; then + # This will only show a warning if the user has not accepted the warning + /usr/libexec/bazzite-sdl-gpu-warn & +fi + # Simply launches the "yafti" GUI with the uBlue image's configuration. /usr/bin/yafti /usr/share/ublue-os/firstboot/yafti.yml