From b6ed88facf5480c2e81ee843bbb8e37958b9d17c Mon Sep 17 00:00:00 2001 From: TLD136 <48219004+TLD136@users.noreply.github.com> Date: Fri, 5 Jul 2024 18:01:43 +0200 Subject: Make Zenity work as root on Wayland --- gui/user_install_script.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) mode change 100644 => 100755 gui/user_install_script.sh diff --git a/gui/user_install_script.sh b/gui/user_install_script.sh old mode 100644 new mode 100755 index ff7be0e..504f5ed --- a/gui/user_install_script.sh +++ b/gui/user_install_script.sh @@ -7,7 +7,14 @@ temp_pass_cleanup() { # removes unhelpful GTK warnings zen_nospam() { - zenity 2> >(grep -v 'Gtk' >&2) "$@" +# If we are on a wayland compositor the Wayland socket will be on /run/user/$UID(probaby 1000)/wayland-[socket-number]. +# When running Zenity under root(sudo) Zenity will assume /run/user/0/wayland-[socket-number]. +# That is not correct because the Wayland compositor is not running as root +if [ $EUID = 0 ] && [ "$XDG_SESSION_TYPE" = "wayland" ]; then + WAYLAND_DISPLAY="$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" XDG_RUNTIME_DIR="/run/user/0" zenity "$@" 2> >(grep -v 'Gtk' >&2) +else + zenity 2> >(grep -v 'Gtk' >&2) "$@" +fi } # check if JQ is installed @@ -58,7 +65,7 @@ if (( $EUID != 0 )); then zen_nospam --title="Decky Installer" --width=300 --height=100 --warning --text "You appear to not be on a deck.\nDecky should still mostly work, but you may not get full functionality." fi - echo "$PASS" | sudo -S -k bash "$0" "$@" # rerun script as root + echo "$PASS" | sudo -E -S -k bash "$0" "$@" # rerun script as root exit 1 fi -- cgit v1.2.3 From 3d6c815db1f83eda3b72be393edb520976719a4b Mon Sep 17 00:00:00 2001 From: TLD136 <48219004+TLD136@users.noreply.github.com> Date: Tue, 9 Jul 2024 20:43:24 +0200 Subject: Remove unnecessary check --- gui/user_install_script.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) mode change 100755 => 100644 gui/user_install_script.sh diff --git a/gui/user_install_script.sh b/gui/user_install_script.sh old mode 100755 new mode 100644 index 504f5ed..1d7a119 --- a/gui/user_install_script.sh +++ b/gui/user_install_script.sh @@ -7,14 +7,7 @@ temp_pass_cleanup() { # removes unhelpful GTK warnings zen_nospam() { -# If we are on a wayland compositor the Wayland socket will be on /run/user/$UID(probaby 1000)/wayland-[socket-number]. -# When running Zenity under root(sudo) Zenity will assume /run/user/0/wayland-[socket-number]. -# That is not correct because the Wayland compositor is not running as root -if [ $EUID = 0 ] && [ "$XDG_SESSION_TYPE" = "wayland" ]; then - WAYLAND_DISPLAY="$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" XDG_RUNTIME_DIR="/run/user/0" zenity "$@" 2> >(grep -v 'Gtk' >&2) -else - zenity 2> >(grep -v 'Gtk' >&2) "$@" -fi + zenity 2> >(grep -v 'Gtk' >&2) "$@" } # check if JQ is installed -- cgit v1.2.3