GNOME: supend on laptop lid close no longer works since 19.10 upgrade
Per investigations at the end of the question, the issue appears to be caused by GDM running a redundant gsd-power
process. This can simply be killed as soon as you log in. Here's how I've done it:
Create a kill script as follows:
script=~/bin/kill_gdm_gsd-power.sh cat > $script << EOF #!/bin/sh sudo pkill -u gdm gsd-power EOF chmod 755 $script
Your account will need to be allowed to run
sudo pkill
without a password prompt (make sure you're comfortable with this). Runsudo visudo -f /etc/sudoers.d/NOPASSWD
and enter the followingCmnd_Alias PKILL = /usr/bin/pkill user ALL=(ALL) NOPASSWD: PKILL
(replace
user
above with your own user id)Open the GNOME startup apps applet (
gnome-session-properties
) and add an entry with your script, so it runs as soon as you log on.
Ideally we'd find a way to prevent gsd-power
from starting up altogether but I found this non-trivial... Please chip in if you find a better way.
A slightly cleaner solution might be to cook a custom handle-lid-switch
script per this solution but the script would primarily have to be installed for the gdm
user and this may also not be trivial...
There might be some side-effects to killing gdm's gsd-power
process, eg: if you log out and leave the laptop to the GDM greeting screen but I think this isn't a scenario many of us will run into.