if grep open /proc/acpi/button/lid/LID/state; then
#lid opened
else
#lid closed
fi
should work
2) try using "DISPLAY=:0 /usr/X11R6/bin/xset dpms force off"
3) dunno - they probably suggest using a run level so that system daemons can be shutoff when on battery (who want's apache running when on battery power)
I'd say just add the service calls manually for now, i.e. call /etc/rc.d/httpd stop on battery, and start on ac...
#!/bin/sh
# Default acpi script that takes an entry for all actions
# NOTE: This is a 2.6-centric script. If you use 2.4.x, you'll have to
# modify it to not use /sys
minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
set $*
case "$1" in
button/lid)
#echo "LID switched!">/dev/tty5
echo "LID switched!"
/usr/X11R6/bin/xset dpms force off
;;
*)
logger "ACPI group/action undefined: $1 / $2"
;;
esac
Above forces off the screen when button/lid event is registered (both open and closed)..
Question 1: How do I make a different action to be taken when the lid is closed and when the lid is opened?? I want the screen to be offed as long as the lid is closed, even though I move mouse while the lid is closed..
Question 2: when I look at the log file, it says "/usr/X11R6/bin/xset: unable to open display "" "
I can log in as root and manually execute xset command ...but I don't know why I'm getting that error message..
Question 3: for battery, I read gentoo document and it said making battery runlevel (and other runlevels) is good way to use acpi, but how do I make new runlevels in arch? is there an arch way of doing acpi properly?
Basically, I want to suspend to disk when I'm running on battery AND battery juice is almost out...(i'll never hibernate when I'm running on ac adapter)..
Thank you.
]]>