if [ `pidof xscreensaver` ]; then
	su "$user" -s /bin/sh -c "(xscreensaver-command -throttle)"
		if [ x$LOCK_SCREEN = xtrue ]; then	
		su "$user" -s /bin/sh -c "(xscreensaver-command -lock)"
	fi
elif [ `pidof dcopserver` ]; then
	if [ x$LOCK_SCREEN = xtrue ]; then
		avail_sessions=`dcop --all-users --list-sessions | grep '.DCOP.*__0'`
    		# send the lock command to all sessions
    		for session in $avail_sessions; do
		    	# /dev/null because dcop warns if it can't connect to X (this is normal!)
		    	dcop --session "$session" --all-users kdesktop KScreensaverIface lock > /dev/null 2>&1
    		done
	fi
fi

case "$DISPLAY_DPMS" in
  xset)
	su "$user" -s /bin/sh -c "xset dpms force off"
	;;
  xrandr)
	su "$user" -s /bin/sh -c "xrandr --output LVDS --off"
	;;
  vbetool)
	/usr/sbin/vbetool dpms off 
	;;
esac

if [ x$RADEON_LIGHT = xtrue ]; then
    [ -x /usr/sbin/radeontool ] && radeontool light off
fi
