#!/bin/bash

# Wait 20 seconds to Xorg Start
sleep 20

# If xorg or wayland not started use lxdm login manager
if ! ps -e | grep -q -e Xorg -e wayland -e mutter -e kwin -e gnome-shell; then

	sleep 5

	# Second verify
	if ! ps -e | grep -q -e Xorg -e wayland -e mutter -e kwin -e gnome-shell; then

		# Force to use Xbig
		sed -i 's|arg=.*|arg=/usr/bin/Xbig|g' /etc/lxdm/lxdm.conf
		systemctl start lxdm
	fi
fi
