#!/bin/sh
#
# This script toggles the metacity compositor on/off
# Written by George Vlahavas (vlahavas~at~gmail~dot~com, gapan@zenwalk forums)

usage()
{
	echo -e "Usage: metacity-compositor [on/off]\n"
	echo "OPTIONS:"
	echo -e "\t on  : Turn metacity compositor on"
	echo -e "\t off : Turn metacity compositor off"
}

if [ $# != 1 ]; then
	usage
	exit
else
	case $1 in
		on)
			STATE="enabled"
			FLAG="true";;
		off)
			STATE="disabled"
			FLAG="false";;
		*)
		usage
		exit;;
	esac
fi

gconftool-2 --type boolean --set /apps/metacity/general/compositing_manager $FLAG && echo "Metacity compositor is now $STATE."
