Skip to content

Commit 47ebc27

Browse files
committed
Properly detect Wayland display
1 parent 615633a commit 47ebc27

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

conty-start.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if [ $EUID = 0 ] && [ -z "$ALLOW_ROOT" ]; then
1212
exit 1
1313
fi
1414

15-
script_version="1.17"
15+
script_version="1.17.1"
1616

1717
# Full path to the script
1818
script_literal="${BASH_SOURCE[0]}"
@@ -43,7 +43,7 @@ mount_point="${working_dir}"/mnt
4343
# a problem with mounting the image due to an incorrectly calculated offset.
4444

4545
# The size of this script
46-
scriptsize=29367
46+
scriptsize=29501
4747

4848
# The size of the utils.tar.gz archive
4949
# utils.tar.gz contains bwrap, squashfuse and dwarfs binaries
@@ -548,6 +548,12 @@ run_bwrap () {
548548
unset custom_home
549549
unset bind_items
550550

551+
if [ -n "${WAYLAND_DISPLAY}" ]; then
552+
wayland_socket="${WAYLAND_DISPLAY}"
553+
else
554+
wayland_socket="wayland-0"
555+
fi
556+
551557
if [ "${SANDBOX}" = 1 ]; then
552558
sandbox_params="--tmpfs /home \
553559
--dir ${HOME} \
@@ -564,7 +570,7 @@ run_bwrap () {
564570
sandbox_level_msg="(level 2)"
565571
sandbox_params="${sandbox_params} \
566572
--dir /run/user/${EUID} \
567-
--ro-bind-try /run/user/${EUID}/wayland-0 /run/user/${EUID}/wayland-0 \
573+
--ro-bind-try /run/user/${EUID}/${wayland_socket} /run/user/${EUID}/${wayland_socket} \
568574
--unshare-pid \
569575
--unshare-user-try \
570576
--unsetenv DBUS_SESSION_BUS_ADDRESS"

0 commit comments

Comments
 (0)