Skip to content

Commit

Permalink
wayland: Wait for VT switch for LightDM users before starting compositor
Browse files Browse the repository at this point in the history
This specifically workarounds canonical/lightdm#63.
  • Loading branch information
bobby285271 authored and Tamaranch committed Nov 5, 2024
1 parent bfe8979 commit 268e2fc
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions scripts/xinitrc.in.in
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,23 @@ if test "x$XFCE4_SESSION_WITH_CK" = "x1"; then
exit 1
fi
else
# workaround https://github.com/canonical/lightdm/issues/63
if [ -n "$XDG_VTNR" ] && [ -f "/sys/devices/virtual/tty/tty0/active" ]; then
VT_TEST_CNT=1
while true; do
CURRENT_VT=$(cat /sys/devices/virtual/tty/tty0/active)
if [ "$CURRENT_VT" = "tty$XDG_VTNR" ]; then
break
fi
VT_TEST_CNT=$((VT_TEST_CNT + 1))
if [ "$VT_TEST_CNT" -gt 100 ]; then
echo "VT $XDG_VTNR is expected but the switch did not happen in the last second, continuing anyway."
break
fi
sleep 0.01
done
fi

# start xfce4-session normally
exec $XFCE4_SESSION_COMPOSITOR xfce4-session
fi
Expand Down

0 comments on commit 268e2fc

Please sign in to comment.