#! /bin/bash

PATHDM=/usr/share/system-switch-displaymanager

if [ -n "$DISPLAY" -a -z "$1" ] ; then
	if [ -x $PATHDM/system-switch-displaymanager-gui.py ] ; then
		exec /usr/bin/pkexec $PATHDM/system-switch-displaymanager-gui.py
	else
		echo "Display Manager Switcher GUI is unavailable."
		echo "Please install the switch-displaymanager-gnome package or use"
		echo "system-switch-displaymanager [display manager]."
		exit 1
	fi
fi

exec /usr/bin/pkexec $PATHDM/system-switch-displaymanager-helper $1
