You are not logged in.
I would want my laptop to keep running even if I close the lid. I want to be able to start a long C++ simulation, close the lid and pack my laptop. After a while, when I get home, I want to open my laptop and keep working (the simulation should have kept running while I had my laptop closed).
I followed the instructions here (https://wiki.archlinux.org/title/Power_management) under "Power management with systemd"
I modified
/etc/systemd/logind.conf Specifically the:
#HandleLidSwitch
#HandleLidSwitchExternalPowerNow my file looks like this:
[me@frankenstein ~]$ cat /etc/systemd/logind.conf
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
# Entries in this file show the compile time defaults. Local configuration
# should be created by either modifying this file, or by creating "drop-ins" in
# the logind.conf.d/ subdirectory. The latter is generally recommended.
# Defaults can be restored by simply deleting this file and all drop-ins.
#
# Use 'systemd-analyze cat-config systemd/logind.conf' to display the full config.
#
# See logind.conf(5) for details.
[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#UserStopDelaySec=10
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=ignore
#HandleLidSwitchExternalPower=ignore
#HandleLidSwitchDocked=ignore
#HandleRebootKey=reboot
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#RebootKeyIgnoreInhibited=no
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RuntimeDirectoryInodes=400k
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192Finally, to apply the changes, I did:
[me@frankenstein ~]$ systemctl kill -s HUP systemd-logindI would expect my laptop to ignore the lid closing completely. But if I have a Youtube video playing, and then I close the lid, the video stops.
Did I miss anything?
Thanks.
Last edited by DJArch (2021-06-27 15:21:46)
Offline
You have to uncomment the line for it to have any effect.
Offline
You have to uncomment the line for it to have any effect.
Well, that was embarrasing. Thanks.
Problem solved.
Just a quick follow-up question:
Then how did the computer know to "suspend" when the lid closes if the original
#HandleLidSwitch=suspendwas commented?
Thanks again,
Offline
It's the default behavior
Offline
As for running a long simulation while it is closed, great. But, if it requires a lot of processing resources, make sure it can breath; you may not want to stuff it in a backpack lest it cook itself.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline