Since I often use my laptop as a desktop PC, I don't want it to suspend itself when I close the lid.
Gnome has the Tweak Tool, a GUI tool to change a number of settings. You can use it to ignore a closing lid, but this setting doesn't seem to be persistent. When I restart the laptop, closing the lid suspends it again.
It turns out that systemd manages this particular detail. It can be configured in /etc/systemd/logind.conf
:
$ sudo vi /etc/systemd/logind.conf
HandleLidSwitch=ignore
$ sudo systemctl restart systemd-logind
It does what it claims to do: Closing the lid has no effect.
The setting is case-sensitive; a value of Ignore
is not recognized:
$ sudo journalctl -u systemd-logind
G
systemd-logind[4372]: [/etc/systemd/logind.conf:24] Failed to parse handle action setting, ignoring: Ignore
...
systemd-logind[4372]: Lid closed.
systemd-logind[4372]: Suspending...
systemd-logind[4372]: Lid opened.
Reference: https://ask.fedoraproject.org/en/question/27808/preventing-lid-close-suspension/