To run LXLE on old laptops used by non power users, suspend on lid close is very important, as this is the only suspend action many users know. Requiring manual suspend throught the start menu leads to frequent unintended battery drain and, more dangerously, overheating of laptops carried in bags, which frying hard drives.
Here are the steps I took to enable reliable suspend on lid closing on an 8 year old laptop in LXLE.
I learned through this LXDE forum post that suspend on laptop lid closing is not implemented in the default power manager, so I caved and installed xfce4-power-manager instead. I start it through Preferences->Default applications for LX Session: Power Manager: Other: xfce4-power-manager --no-daemon similarly to what is described at http://askubuntu.com/questions/471713/xfce4-power-manager-does-not-open
This allows it to load reliably on startup, which it did not by default (it would often show up as running with ps aux | grep xfce4-power-manager but without a visible icon in the system tray, so it could not be onfigured).
After these steps and configuring xfce4-power-manager to suspend on lid close, the laptop would still most times not suspend when closing the lid. Upon opening the lid, the laptop would then suspend. This lead me to suspect that there may be a race between the execution of the /etc/acpi/lid.sh script and the update of the lid state in /proc/acpi/button/lid/*/state
To test this hypothesis, I inserted a sleep 1 statement into the script just before it tests the content of the /proc/acpi/button/lid/*/state file.
The laptop now reliably suspends on lid close every time.
I don't have the time to find more elegant ways to do this (e.g. wait only exactly until the state of /proc/acpi/button/lid/*/state changes), so I would welcome any suggestions for implementing this with this or other (smaller footprint) power managers.
Full listing of /etc/acpi/lid.sh after the break. ___
#!/bin/bash # TODO: Change the above to /bin/sh
test -f /usr/share/acpi-support/state-funcs || exit 0
grep -q closed /proc/acpi/button/lid/*/state if [ $? = 0 ] then for x in /tmp/.X11-unix/*; do displaynum=`echo $x | sed s#/tmp/.X11-unix/X##` getXuser; if [ x"$XAUTHORITY" != x"" ]; then export DISPLAY=":$displaynum" . /usr/share/acpi-support/screenblank fi done else for x in /tmp/.X11-unix/*; do displaynum=`echo $x | sed s#/tmp/.X11-unix/X##` getXuser; if [ x"$XAUTHORITY" != x"" ]; then export DISPLAY=":$displaynum" grep -q off-line /proc/acpi/ac_adapter/*/state if [ $? = 1 ] then if pidof xscreensaver > /dev/null; then su $user -c "xscreensaver-command -unthrottle" fi fi if [ x$RADEON_LIGHT = xtrue ]; then [ -x /usr/sbin/radeontool ] && radeontool light on fi if [ `pidof xscreensaver` ]; then su $user -c "xscreensaver-command -deactivate" fi su $user -c "xset dpms force on" fi done fi ___
LXLE 32bit 12.04.5 on Dell Inspiron E1505, Intel core duo HDA sound, ATI X1400 graphics, internal LVDS 1280x1200, external VGA 1920x1200
Power Management is already provided by tlp. My laptop I'm on now when the lid closes eventually goes into power saving mode automatically. Perhaps adjusting TLP might prove easier.