I have recently had an issue with suspending my laptop (GNOME on 18.04 LTS) - when I wake from sleep, sometimes my login session gets killed and I have to log in all over again. But I have found that if I type systemctl suspend
before shutting the lid, I do not have this issue at all.
But I am tired of having to type this command every time before I shut the lid, and sometimes I don't have time to unlock the computer and type it, I need to just shut the lid and go. So I was trying to change the behavior of shutting the lid to running this command instead of whatever it is doing now. But apparently the lid action is controlled by /etc/systemd/logind.conf
in the line that reads:
HandleLidSwitch=suspend
This doesn't tell me how the system is actually being suspended so I can change it to systemctl suspend
! In this file is says to reference the logind.conf man page which itself references the systemd-logind.service man page which doesn't seem to have any useful info. It also has this tidbit:
A different application may disable logind's handling of system power and sleep keys and the lid switch by taking a low-level inhibitor lock ("handle-power-key", "handle-suspend-key", "handle-hibernate-key", "handle-lid-switch"). This is most commonly used by graphical desktop environments to take over suspend and hibernation handling, and to use their own configuration mechanisms.
So it's possible that this is how the system is actually suspending things, which might be why the expected method isn't being used. But it's unclear where I would actually look (taking a lock sounds like something that might be done in source code hidden by compilation to a binary, for example).
How can I set the actual command to run when the lid is closed to systemctl suspend
?
0 Answers