I have Ubuntu 5.04 on my IBM ThinkPad T22, which was set up with ACPI. When the alptop is on my desk, it's connected to an external monitor and I switch the ThinkPad to use only that monitor as the display. I then want to close the lid and set the laptop aside, but the closing of the lid causes ACPI to shut off all screens and locks X.
There don't seem to be any ACPI-related configuration programs included so I started looking at the scripts in /etc/acpi. It knows when the AC adapter is plugged in and when the lid is closed it runs this script:
Code:
#!/bin/sh
. /usr/share/acpi-support/power-funcs
getXuser;
grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then
. /usr/share/acpi-support/screenblank
echo `fgconsole` > $LIDSTATE
chvt 12
else
grep -q off-line /proc/acpi/ac_adapter/*/state
if [ $? = 1 ]
then
su - $user -c "xscreensaver-command -unthrottle"
fi
chvt `cat $LIDSTATE`
su - $user -c "xscreensaver-command -deactivate"
fi
[ -x /etc/acpi/local/lid.sh.post ] && /etc/acpi/local/lid.sh.post
Can I modify this to make do something like "if the lid is closed and the AC adapter is not plugged in (ie: on battery), turn off the screen. Otherwise, do nothing"? -- I think that at least this way the hardware will shut off the built-in screen but the external monitor will keep working fine. If so, how would I go about doing it?
And, perhaps a better question: any assugestions for how to set this stuff up the way I need it to work?
Thanks.