Suspend on lid close on LXDE, Ubuntu

lxdeBy default LXDE does not suspend the laptop on lid closure. I was trying to enable suspend on sleep as most of the time I close the lid when I am not using the laptop. It saves power and at the same time resume is faster as everything is still in RAM. The event responsible for lid closure or open is button/lid. What you need to do is to bind it with an action to suspend the laptop. However you need to take care that suspension is done only on lid closure. Here’s what I did on Ubuntu 13.04 as root:

  1. Add the following in /etc/acpi/events/lid:
    event=button/lid
    action=/etc/acpi/actions/lid.sh %e
  2. The directory for action scripts may not exist by default on Ubuntu. Create it:
    mkdir -p /etc/acpi/actions
  3. Add action to suspend when the event occurs. Create /etc/acpi/actions/lid.sh and add:
    #!/bin/bash
    echo "$1" | grep -q open /proc/acpi/button/lid/LID0/state && exit 0
    sleep 2
    /usr/sbin/pm-suspend
  4. Make the script executable and restart the acpid service:
    chmod +x /etc/acpi/actions/lid.sh
    restart acpid

Useful links:

2 thoughts on “Suspend on lid close on LXDE, Ubuntu”

  1. On my Ubuntu install I had to edit /etc/acpi/events/lidbtn instead of “lid.” Also, there was already a /etc/acpi/lid.sh so I added what you suggested to the end of that file.

Leave a Reply

Your email address will not be published. Required fields are marked *