So, after lots of googling around, I finally came up with the optimum configuration which uses what I hope are lighter-weight services.
First, I had to install acpid to respond to lid close/open events (my code is based on this post):
yum install acpid
I hunted through the LXDE source code and discovered that lxde-logout uses a dbus call to HAL to trigger the suspend. I found a great blog post describing how to do this from a script. I implemented that by doing creating the following files:
/etc/acpi/events/lid (update: don't put a dot in the filename for Fedora 14+, it seems a new version of acpid ignores all files with dots in their names)
event=button/lid
action=/etc/acpi/actions/lid.sh
/etc/acpi/actions/lid.sh
#!/bin/bash
# maybe this sleep isn't needed, but just to make sure the lid close event doesn't trigger immediate wake-up
sleep 2
# make sure the lid is closed
grep -q open /proc/acpi/button/lid/LID/state && exit 0
# suspend
dbus-send --system --dest=org.freedesktop.Hal --type=method_call --print-reply /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Suspend int32:0
5 comments:
Hi,
The "dbus-send..." command did not work for me, but a simple "pm-suspend" did!
Thanks for the tip,
-Bjarni
for me pm-suspend didn't work, I don't know why, but systemctl suspend worked (on Fedora 17).
In Linux Mint 14 (nadia) this worked:
cd /etc/acpi
sudo vi lid.sh
add pm-suspend as follows:
if [ x"$XAUTHORITY" != x"" ]; then
export DISPLAY=":$displaynum"
. /usr/share/acpi-support/screenblank
# Allow suspend in lxde when lid is closed
pm-suspend
fi
I've solve it uncommenting variable LID_SLEEP=true from /etc/default/acpi-support , then service acpid restart
Post a Comment