The awesome WM doesn't suspend automatically when closing the lid, so I followed some instructions to get it working. I simply added a file /etc/acpi/local/lid.sh.post with the following contents:#!/bin/shpm-suspendSuspending works now, but after I open the lid and press the power button it shows the desktop for a fraction of a second before suspending again! The second time I press the power button it resumes properly. After that, any time I suspend I have to press the power button and wait three times before it resumes properly. I've tried suspending four times in a row, and it doesn't seem to get any worse.Edit: I'm using a simple screen lock service instead of the original script:[Unit]Description=Lock X sessionBefore=sleep.target[Service]Environment=DISPLAY=:0ExecStart=/usr/bin/xautolock -locknow[Install]WantedBy=sleep.targetIt's not a perfect solution, though.Solved! If anybody else wants it, I made a script to do this in one command:#!/usr/bin/env bash## NAME#        suspend-on-close.sh - Enable suspend when closing laptop lid## SYNOPSIS#        suspend-on-close.sh [options]## DESCRIPTION#        Adds a new post event to the ACPI lid close handler## BUGS#        https://github.com/l0b0/tilde/issues## COPYRIGHT#        Copyright  2013-2014 Victor Engmark. License GPLv3+: GNU GPL#        version 3 or later <http://gnu.org/licenses/gpl.html>.#        This is free software: you are free to change and redistribute it.#        There is NO WARRANTY, to the extent permitted by law.#################################################################################set -o errexit -o noclobber -o nounset -o pipefaildirectory=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)PATH='/usr/bin:/bin'target_dir=/etc/acpi/localtarget_file=${target_dir}/lid.sh.postif [[ ! -d $target_dir ]]then    mkdir $target_dirfi> $target_file cat <<EOF#!/bin/shgrep -q closed /proc/acpi/button/lid/*/state && pm-suspendEOFchmod u+x $target_file
Why does my laptop suspend twice/thrice?
ubuntu;awesome;acpi
I'm pretty sure that your lid callback is going to be called every time the lid is closed as well as opened.The sleep.sh file here states:# if launched through a lid event and lid is open, do nothingecho $1 | grep button/lid && grep -q open /proc/acpi/button/lid/LID/state && exit 0the lid open scenario is one your script is not checking for...You could quickly test this by echoing some parameters to a log file