#!/bin/sh

# sqp_JogglerPower v1.03 (13th April 2012) by Andy Davison
#  Executed by JogglerPower and Quit applets.

PLATFORM=`cat /tmp/sqp_platform`
[ "$PLATFORM" = "native" ] || export PATH=$PATH:`dirname $0`

if [ "$1" = "platform" ]; then
	echo -n $PLATFORM
	exit 0
fi

if [ "$1" = "quit" ]; then

	xset -display :0.0 dpms 0 0 0
	sqp_JogglerPower.sh `cat /tmp/sqp_initial_bl` &

	if [ "$PLATFORM" != "native" ] && [ "$PLATFORM" != "sqpos" ]; then
		/usr/bin/gnome-power-manager &
		togglepanel.sh show
	fi

fi

if [ "$1" = "reboot" ]; then

	if [ "$PLATFORM" = "native" ]; then
		reboot
	else
		sudo reboot
	fi

fi

if [ "$1" = "halt" ]; then

	if [ "$PLATFORM" = "native" ]; then
		halt
	else
		sudo halt
	fi

fi

exit 0