Xfce 4.12 not suspending on laptop-lid close
Xfce 4.12 as default in Ubuntu/Xubuntu 18.04 LTS did not suspend a laptop after closing the lid. In fact running
xfce4-power-manager --quit ; xfce4-power-manager --no-daemon --debug
showed that xfce4 wasn't seeing a laptop lid close event at all.
To the contrary acpi_listen
nicely finds button/lid LID close
and button/lid LID open
events when folding the screen and opening it up again.
As so often the wonderful docs / community of Arch Linux to the rescue. This forum thread from 2015 received the correct answer in 2017:
Xfce4 basically recognizes systemd and thus disables its built-in power-management options for handling these "button events" (but doesn't tell you so in the config UI for power-manager). Systemd is configured to handle these events by default (/etc/systemd/logind.conf
has HandleLidSwitch=suspend
but for unknown reasons decides not to honor that).
So best is to teach Xfce4 to handle the events again as in pre-systemd times:
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/logind-handle-lid-switch -s false
Now the UI options will work again as intended and the laptop suspends on lid close and resumes on lid open.
Update:
07.01.19: Changed XFCE -> Xfce as per Corsac's suggestion in the comments below. Thank you!
Background info:
The name "XFCE" was originally an acronym for "XForms Common Environment", but since that time it has been rewritten twice and no longer uses the XForms toolkit. The name survived, but it is no longer capitalized as "XFCE", but rather as "Xfce". The developers' current stance is that the initialism no longer stands for anything specific. After noting this, the FAQ on the Xfce Wiki comments "(suggestion: X Freakin' Cool Environment)".
(quoted from Wikipedia's Xfce article also found in the Xfce docs FAQ).