Skip to content

Commit cb422f0

Browse files
authored
Strip screen number from DISPLAY when locating X11 socket (#364)
* Strip screen number from DISPLAY when locating X11 socket DISPLAY values like :0.0 produced socket path X0.0, but the socket is named X0. Window manager detection failed with 'Can't run Zwift without window manager'. Strip the screen-number suffix before the check. Fixes #363 * Strip screen number from DISPLAY in build-image.sh X11 check
1 parent 15929bb commit cb422f0

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/build-image.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@ fi
127127

128128
# Configure window manager
129129
msgbox info "Using X11 window manager"
130-
if [[ -z ${DISPLAY} ]] || [[ ! -S /tmp/.X11-unix/X${DISPLAY#*:} ]]; then
130+
# DISPLAY is [host]:displaynumber[.screennumber] but the X11 socket is named
131+
# by the display number alone, so strip the host prefix and screen suffix.
132+
x11_display="${DISPLAY#*:}"
133+
x11_display="${x11_display%.*}"
134+
if [[ -z ${DISPLAY} ]] || [[ ! -S /tmp/.X11-unix/X${x11_display} ]]; then
131135
msgbox error "X11 is not running!"
132136
exit 1
133137
fi

src/zwift.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,9 +591,13 @@ if [[ ${WINE_EXPERIMENTAL_WAYLAND} -eq 1 ]]; then
591591
fi
592592
fi
593593
if [[ -z ${window_manager} ]]; then
594+
# DISPLAY is [host]:displaynumber[.screennumber] but the X11 socket is named
595+
# by the display number alone, so strip the host prefix and screen suffix.
596+
x11_display="${DISPLAY#*:}"
597+
x11_display="${x11_display%.*}"
594598
if [[ -n ${WAYLAND_DISPLAY} ]]; then
595599
window_manager="XWayland"
596-
elif [[ -n ${DISPLAY} ]] && [[ -S /tmp/.X11-unix/X${DISPLAY#*:} ]]; then
600+
elif [[ -n ${DISPLAY} ]] && [[ -S /tmp/.X11-unix/X${x11_display} ]]; then
597601
window_manager="XOrg"
598602
else # no window manager, tty?
599603
msgbox error "Can't run Zwift without window manager"

0 commit comments

Comments
 (0)