Keep programs running while in sleep mode?

I’m not sure when KDE goes in sleep mode: is it the same as when the screen goes dark?
Anyway, I was wondering: I have the impression that when my laptop goes to sleepmode, all programs stop as well. Like Transmission stops up/downloading and Free File Sync stops comparing or syncing.
Can I prevent that in general? Or do I have to allow that or activate that for each program individual?

The functionality of “sleep” means that the CPU is put into “sleep mode” and can no longer be used to run applications until it is woken up. Depending on what hardware exactly is in your computer, other sub-systems may also sleep or not - for example, with most modern laptops the WiFi isn’t sleeping and the computer stays connected to the network, though no applications are actually running so you can’t have bittorrents downloading and uploading.

You can’t “whitelist” certain applications not to sleep - because the CPU itself is put to sleep then nothing can run, not even the operating system. If you want to keep your applications running when you stop using the computer, you need to disable “idle sleep” - use the Plasma Energy Saving control panel to disable sleeping.

Here is how my Energy Saving is setup, to prevent the computer from sleeping when it is connected to power and otherwise idle:


See how the “Do nothing” option is highlighted - that is because it is not the default setting and I have changed it: the default was to sleep after 15 minutes of inactivity.


The sollution you got is probably what you should do.

But It got me a bit curious, can you not use systemd for this?
So I searched the interweb and bumped into this.

If you feel curious and adventurous, maybe starting transmission with systemd-inhibit transmission from cli would prevent sleep while transmission is running.

I did not know about this before, and have never tested anything with it, but made me curious, maybe you too. :slight_smile:

systemd-inhibit may be used to execute a program with a shutdown, sleep, or idle inhibitor lock taken. The lock will be acquired before the specified command line is executed and released afterwards.

Yes, that should work, but it doesn’t under Plasma. See bug #457859.


I can workaround the issue by stopping PowerDevil using systemctl --user stop plasma-powerdevil.service, and then closing the lid without using systemd-inhibit puts the computer to sleep, while doing so while systemd-inhibit is running (as per the above command) correctly prevents the computer from sleeping.

That is a GREAT analysis!
I also identify problems with powerdevil, but for me it is the dimming of the screen.
Might be powerdevil is not entirely correctly coded when making calls.