KDE Login Screen (SDDM) and Power Management

Is there any way to configure KDE’s login screen (SDDM) to use energy saving options / power settings?

While SDDM does turn off the display after some inactivity, I could not find an option to tell it to suspend my system after some inactivity time.

Couldn’t find an option in KDE’s system settings (neither under “Login Screen (SDDM)” nor under “Power Management”).

I want to ensure that my system does not run out of battery after a zypper dup and reboot (and me “forgetting” the system, doing other stuff).

Same applies to Leap 15.3. System is not going to sleep if idling in logon screen (SDDM).

I would say, sleep before user login has to be handled system wide. That may be done by systemd. Very probably the service in charge is disabled, as that is the preset (at least in Leap 15.2).

systemctl status systemd-suspend
systemctl status systemd-hibernate
systemctl status systemd-hybrid-sleep

They can be invoked with “enable” and the “start” instead of “status”. But this must be handled with care. From what I have learned in this forum you can mess up if to try to send your system to sleep and your swap is smaller than your RAM. What I don’t know if that is the case in suspend and/or hibernate. As my swap is rather small I never dared trying it. And of course it will go to sleep if not in graphical mode / login window.

The related man pages may give you some more information:

man systemd-sleep
man systemd-sleep.conf
man systemd-***.service

with ***= “suspend”, “hibernate” or “hybrid-sleep”.

Better check thoroughly before trying and maybe others have more sophisticated advice than I can give. :wink:

OK, I more or less skipped this because from the title you have given I thought I could not be of help.

But reading what your want to achieve, I guess it is to let the system sleep after some time when nobody is logged in.

I do something like that. I shutdown a system when nobody is logged (and when a client system is down, but that is not important for your case) after 5 to 10 mins.

Those 5 to 10minutes can be adapted of course. What happens is that I test once every 5 mins if somebody is logged in. When no, I make a note of this. Next time (5 mins later), I check again. If nobody logged and there is a note about 5 mins ago, I shutdown the system. I do the double check (two consecutive “nobody there”) to avoid shutting down when somebody happens to log-out and log-in again at the same moment the test is done).

root uses the following script that I have adapted to your case (leaving out the test on another system):

umask 077
FILE="/tmp/System-is idling"
if (( $(who | wc -l) ))
then    rm -f ${FILE}
elif     -a ${FILE} ]]
        then    rm ${FILE}
                /sbin/shutdown -hP +1 "Good night!" >/dev/null 2>&1
        else    touch ${FILE}

root has this script in /root/bin and of course the owner should have x-permission:

boven:~/bin # l nightstop
-rwx------ 1 root root 457 Mar  4  2019 nightstop*
boven:~/bin #

root has a crontab entry to run this every 5 minutes:

boven:~/bin # crontab -l
*/5 * * * *     /root/bin/nightstop
boven:~/bin #

You should of course adapt the line with the shutdown statement with something that makes your system reach the state you need.

Hope this helps.

Try to read some manuals.
Add swap file with needed volume to a swap set and go on.
Also zswap may help.
Suspend is not using swap because RAM is powered.

“with no users logged in, sddm does not suspend session as configured in System Settings.”

Hehe, thanks. :wink:
It wasn’t actually an issue for me. Therefore this has lost the eternal fight of things (I might wish) to do vs. available time. Interestingly, ksysguard tells me on my latptop I do have the same size swap as RAM indeed. I don’t need to hibernate nor suspend the desktops, so all fine here.