Quelle((http://wiki.eeeuser.com/close_lid_shutdown))
====== Howto: Shut down on lid close ======
The suspend mode from closing the lid still drains the battery quite quickly. The following hack shuts down rather than suspends when you close the lid.
When you close the lid on your EEE it runs /etc/acpi/lidbtn.sh
The script to shut down the EEE safely and quickly is called /sbin/fastshutdown.sh
So, if you comment out the line in /etc/acpi/lidbtn.sh that suspends on lid close and add a new line that runs this script, your eeepc will shutdown when the lid is closed.
===== Instructions =====
In the console type
sudo kwrite /etc/acpi/lidbtn.sh
You should see
#!/bin/sh
LID_STATE=`cat /proc/acpi/button/lid/LID/state | awk '{print $2 }'`
if [ $LID_STATE = "closed" ] ; then
/etc/acpi/suspend2ram.sh
fi
exit 0
Add a hash mark before "/etc/acpi/suspend2ram.sh" (this line is now ignored but is still there in case you want to reverse this hack)
Add a new line "/sbin/fastshutdown.sh" as below
#!/bin/sh
LID_STATE=`cat /proc/acpi/button/lid/LID/state | awk '{print $2 }'`
if [ $LID_STATE = "closed" ] ; then
# /etc/acpi/suspend2ram.sh
/sbin/fastshutdown.sh
fi
exit 0
Save and exit then close the lid to test.
See also [[eeePC:fastshutdown]]
==== Shutdown if on battery ====
Because suspend is still a desirable feature, you may still wish to use it when you are plugged in, and only shut down if you are on battery. (unplugging while in suspend WILL NOT cause the machine to shut down)
If you would like eeePC to **suspend** when you have the ac adapter plugged in and the lid closed, but **shut down** when using the battery edit /etc/acpi/lidbtn.sh to look like this:
#!/bin/sh
LID_STATE=`cat /proc/acpi/button/lid/LID/state | awk '{print $2 }'`
PWR_STATE=`cat /proc/acpi/ac_adapter/AC0/state | awk '{print $2 }'`
if [ $LID_STATE = "closed" ] ; then
if [ $PWR_STATE = "off-line" ] ; then
/sbin/fastshutdown.sh ; else
/etc/acpi/suspend2ram.sh
fi
fi
exit 0
===== To Do Nothing On Closing The Lid =====
If you want you can simply leave the line commented out which will allow you to use your EEEPc with the lid closed and an external display (assuming you have a keyboard and mouse plugged in).
Just be careful! Your EEEPc will now do NOTHING when you close the lid!
===== Differing Behaviour Depending On Power Source =====
If you would like eeePC to **stay on** when you have the ac adapter plugged and the lid closed, but **suspend** when using the battery edit /etc/acpi/lidbtn.sh to look like this:
#!/bin/sh
LID_STATE=`cat /proc/acpi/button/lid/LID/state | awk '{print $2 }'`
PWR_STATE=`cat /proc/acpi/ac_adapter/AC0/state | awk '{print $2 }'`
if [ $LID_STATE = "closed" ] ; then
if [ $PWR_STATE = "off-line" ] ; then
/etc/acpi/suspend2ram.sh
fi
fi
exit 0
===== Shutting off screen =====
If you'd rather just shut the screen off to save power use
#!/bin/sh
LID_STATE=`cat /proc/acpi/button/lid/LID/state | awk '{print $2 }'`
if [ $LID_STATE = "closed" ] ; then
# /etc/acpi/suspend2ram.sh
su user -c "DISPLAY=:0 xset dpms force suspend"
elif [ $LID_STATE = "open" ] ; then
su user -c "DISPLAY=:0 xset dpms force on"
fi
as your /etc/acpi/lidbtn.sh
===== How to suspend with the power button =====
If you disabled suspend-on-close with the procedures above, you may wish to suspend in some cases.
* Fn-F1 suspends the computer
* Pressing the power button will give you a menu with suspend as an option (in simple desktop mode)
* In advanced desktop mode, go to start menu > Control Center > System administration > Login manager. Press the "Administrate" button if necessary, then go to the Shutdown tab and check "Display suspend button in logout window".