#!/bin/sh

set -eu

# NOTE!  /usr/lib/puavo-ltsp-client/udev-hotplug-monitor may grep if this
# script is running (to check if a desktop session is running on this host),
# so if you change the interpreter or the script name, please make sure to
# change that as well.  Thank you!

display_server=$(puavo-conf puavo.graphics.display_server)

if [ "$display_server" = 'xorg' ] && [ -x ~/.xsession ]; then
  /etc/X11/Xsession
else
  if [ "$display_server" = 'wayland' ]; then
    . /usr/lib/puavo-desktop/wayland-session
  fi
  gnome-session "$@"
fi
