From 47ebc27410fe99d3a9796dadea80ac5d0afbac1f Mon Sep 17 00:00:00 2001 From: Kron4ek Date: Sat, 2 Oct 2021 18:02:48 +0500 Subject: [PATCH] Properly detect Wayland display --- conty-start.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/conty-start.sh b/conty-start.sh index 7a345e8..1d804a3 100755 --- a/conty-start.sh +++ b/conty-start.sh @@ -12,7 +12,7 @@ if [ $EUID = 0 ] && [ -z "$ALLOW_ROOT" ]; then exit 1 fi -script_version="1.17" +script_version="1.17.1" # Full path to the script script_literal="${BASH_SOURCE[0]}" @@ -43,7 +43,7 @@ mount_point="${working_dir}"/mnt # a problem with mounting the image due to an incorrectly calculated offset. # The size of this script -scriptsize=29367 +scriptsize=29501 # The size of the utils.tar.gz archive # utils.tar.gz contains bwrap, squashfuse and dwarfs binaries @@ -548,6 +548,12 @@ run_bwrap () { unset custom_home unset bind_items + if [ -n "${WAYLAND_DISPLAY}" ]; then + wayland_socket="${WAYLAND_DISPLAY}" + else + wayland_socket="wayland-0" + fi + if [ "${SANDBOX}" = 1 ]; then sandbox_params="--tmpfs /home \ --dir ${HOME} \ @@ -564,7 +570,7 @@ run_bwrap () { sandbox_level_msg="(level 2)" sandbox_params="${sandbox_params} \ --dir /run/user/${EUID} \ - --ro-bind-try /run/user/${EUID}/wayland-0 /run/user/${EUID}/wayland-0 \ + --ro-bind-try /run/user/${EUID}/${wayland_socket} /run/user/${EUID}/${wayland_socket} \ --unshare-pid \ --unshare-user-try \ --unsetenv DBUS_SESSION_BUS_ADDRESS"