#!/usr/bin/env bash
# Wait for the X server, then start the XFCE session (with a dbus session).
set -e
for i in $(seq 1 30); do
  xdpyinfo -display :1 >/dev/null 2>&1 && break
  sleep 1
done
export DISPLAY=:1
export XDG_DATA_DIRS=/usr/local/share:/usr/share
export XDG_CONFIG_DIRS=/etc/xdg
# startxfce4 bails when X is already up; call the session directly.
exec dbus-launch --exit-with-session xfce4-session
