Linux suspend or sleep on lid close

How can Fedora 17 (LXDE spin, if it matters) be configured to sleep or suspend when the lid of a laptop (Lenovo S10 netbook) is closed? With a 'stock' installation (from the LXDE spin live CD), closing the lid doesn't seem to change the machine's state at all (fan still cycles, front LEDs don't change state, uptime unaffected), and when the lid is reopened the keyboard is hot... Thanks!


You may want to read the whole power management guide, but the section about acpid is exactly what you are looking for. On my system I have:

# cat /etc/acpi/events/lid
event=button[ /]lid
action=/etc/acpi/actions/lid_down.sh %e

# cat /etc/acpi/actions/lid_down.sh
#!/bin/bash

#mute alsa.
#amixer sset PCM 0

#echo $*

dec=`echo ibase=16\; ${4^^}|bc`

if [ $(($dec % 2 )) -eq 1 ]
then
        logger "lid down"
else
        logger "lid up"
fi

If I wanted to suspend, I'd call hibernate-ram (tuxonice) instead of logging "lid down". I think the same thing can be done in Fedora with the pm-suspend command. If you find that this command does nothing, then it's likely a driver issue. You will have to research how to properly configure ACPI on that laptop.