Configure acpid for openbox

For some time I use Openbox as a Window Manager. Openbox is a very fast window manager, which is characterized by its high adaptability and low resource requirements. By editing of only three files you can adjust it according to your preferences.

After setup a default configuration for my simplest needs, I wanted to use the sound-buttons on my keybord and to enter suspend-mode if the lid is closed.

At the beginning I suspended my notebook via commandline and the following command:

gnome-screensaver-command --lock && sudo /usr/sbin/pm-suspend

After a while it is very annoying to use console everytime I wanted to suspend my notebook and close the lid.

So I thought that it might be usefull to use acpid to suspend the notebook.


If not installed you need acpid and pm-utils:

sudo apt-get install acpid pm-utils


By default, all ACPI events are passed through the /etc/acpi/ script. This is due to the ruleset outlined in /etc/acpi/events/anything.

# Pass all events to our one handler script
    action=/etc/acpi/ %e

Now I handle the action to close the lid in /etc/acpi/

    case $(cat /proc/acpi/button/lid/LID0/state | awk '{print $2}') in
        closed) DISPLAY=:0.0 su - max -c "gnome-screensaver-command --lock" & /usr/sbin/pm-suspend;;

The format of the state-file is the following:

$ cat /proc/acpi/button/lid/LID0/state
    state:      open

After that configuration just restart the acpid:

sudo service acpid restart


You have to make the /etc/acpi/ executable first:

$ chmod a+x /etc/acpi/
comments powered by Disqus