Skip to content

Commit b6ee5cf

Browse files
Yury-MonZonalchark
authored andcommitted
Fix Wayland display detection in captive portal script
1 parent 380d99f commit b6ee5cf

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

overlays/configs/NetworkManager/dispatcher.d/90-captive-portal

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,22 @@
22
[ "$2" = connectivity-change ] && [ "$CONNECTIVITY_STATE" = PORTAL ] || exit 0
33
session=$(loginctl show-seat seat0 -p ActiveSession --value)
44
[ -n "$session" ] || exit 0
5-
[ "$(loginctl show-session "$session" -p Class --value)" = user ] || exit 0
6-
5+
[ "$(loginctl show-session "$session" -p Class --value)" = user ] || exit 0
76
uid=$(loginctl show-session "$session" -p User --value)
87
name=$(loginctl show-session "$session" -p Name --value)
98
[ -n "$uid" ] && [ -n "$name" ] || exit 0
109
home=$(getent passwd "$name" | cut -d: -f6)
1110
[ -n "$home" ] || exit 0
12-
[ -S "/run/user/$uid/wayland-0" ] || exit 0
13-
11+
for s in "/run/user/$uid"/wayland-[0-9]*; do
12+
[ -S "$s" ] && { wd=${s##*/}; break; }
13+
done
14+
[ -n "$wd" ] || exit 0
1415
exec sudo -u "$name" env \
1516
XDG_RUNTIME_DIR="/run/user/$uid" \
16-
WAYLAND_DISPLAY=wayland-0 \
17+
WAYLAND_DISPLAY="$wd" \
1718
chromium --ozone-platform=wayland \
1819
--password-store=basic \
1920
--user-data-dir="$home/.config/chromium-standalone" \
2021
--force-dark-mode \
21-
--start-maximized http://network-test.debian.org/nm
22+
--start-maximized http://network-test.debian.org/nm
23+

0 commit comments

Comments
 (0)