On current Ubuntu (10.04) suspend-on-lid/FN + F4 only works if some powermanagement-applet of KDE/gnome is running.

But what about suspend-to-lid if you are working on the console or using a non-bloated window-manager?

What is the current mechanism to configure suspend-on-lid system wide?

What of hald/udev/acpid/foo-kit/random-thing is the right place to hook this feature in?

What is the up-to-date command to suspend from the command line/script?

echo -n mem > /sys/power/state

or something else?

Btw, if it matters, I want to configure it on some Thinkpads.


Ryan Thompson described how the system works in an answer to my question earlier.

So, you just need to change /etc/acpi/lid.sh to do whatever you want instead of blanking the screen.


Ok, finally I have configured the suspend-on-lid-close action everywhere via acpid.

For minimal changes to existing system wide config files (i.e. less manual overhead for the next upgrade), I did it like this:

cd /etc/acpi
mkdir local
echo -e "#!/bin/sh\npm-suspend" > local/lid.sh.post
chmod u+x local/lid.sh.post

It is then automatically called by /etc/acpi/lid.sh (if no gnome/kde power-manager running). I used pm-suspend, because it is already used in /etc/acpi/sleep.sh.

Now I have to figure out how to enable Fn+F4 system wide ...

Edit: Well, it seems that Fn+F4 -> sleep (everywhere) should work out-of-the-box under Ubuntu, because the thinkpad-acpi module is loaded by default (when booting a thinkpad) and the default


masks the Fn+F4 event, s.t. an ACPI event should be generated. A default acpid should then call /etc/acpi/sleep.sh (which calls pm-suspend).

First tests of Fn+F4 did not work (i.e. did not trigger acpi events) - but some strange side-effect (e.g.

cat /sys/devices/platform/thinkpad_acpi/hotkey_mask

, toggling the thinklight via

echo on > /proc/acpi/ibm/light

or something like this) made it work now ...

  • Your answer is considerably better than mine, you should've accepted it instead. – vava Sep 4 '10 at 2:18

I run the AwesomeWM on Lucid from my X201 Thinkpad. I just run the gnome-power-manager applet in my WM instance by having it setup in my autostart script for Awesome. It does eat up a little ram (30M res) but works well with the normal hibernate/suspend modes. The nice thing is it also gives me my battery indicator and such as well.

I know it's not just the script commands, but my understanding is that there more than just a script to run. It starts up and monitors some events, dbus, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.