KDE Plasma - Is there an option to suspend "sleep", "screen shutdown" for certain applications?

Running Spotify Arch package doesn’t seem to suspend sleep when music is playing, the PC goes into deep sleep anyway.

I was tinkering with things and found out about this:

Shouldn’t there be a properly “skip sleep”, “skip suspend”, “skip lockscreen”? This looks like a pretty convenient tool, but it lacks options bad!

Is there any way to make it so the PC isn’t going to sleep when certain conditions are met? I’d say if there’s a full screen application running - there shouldn’t be sleep timer, e.g. in games. If there’s music playing it shouldn’t sleep either. It may lock the screen but not actually suspend.

I know about the manual switch in the power management to disable sleep entirely, and I know about “activities” but having smarter controls about how PC recognizes the need in suspending itself would be much more modern.

Usually application can indicate to the system that it isn’t supposed to go to sleep. For example Firefox playing a video:

If an application doesn’t do that by itself you can manually enforce it, e.g. by wrapping it with systemd-inhibit on systemd based distros (which applies to Arch).

One way is to modify the .desktop entry by editing it in the KDE Menu Editor. Let’s say I want that behavior for mpv:

See also man systemd-inhibit.

PS: Would it be nice to have it as a window rule? Agreed.

2 Likes

I understand that some software is supposed to issue signals like that but apparently not this package which I like otherwise.

I will use the workaround proposed for now, but additional properties like this sound like they just have to be introduced at this point. This entire “app and window rules” feature is awesome. If it just had more flexibility it would be a lifesaver.