#!/bin/sh

# acpi call will return an empty string if no battery is detected. 
# So bail if this is so...
x=`acpi 2>/dev/null`
if [ -z "$x" ]; then
	exit 0
fi
# fire up the battery-related stuff.
#
# make  the battery monitor app executable so that icewm startup runs it
chmod a+x /usr/bin/cbatticon
# add the call to xautolock to icewm statup
# which is used to turn off the screen on idle
echo "/usr/bin/xautolock -time 8 2>/dev/null&" >> /etc/skel/.icewm/startup
echo "/usr/bin/xautolock -time 8 2>/dev/null&" >> /$HOME/.icewm/startup
# and fire up xautolock for the current session
/usr/bin/xautolock -time 8 2>/dev/null&
exit 0
