Prevent suspend & keep the screen on

Some applications do not keep the screen on and the screensaver (or suspend) kicks in. (Video players such as mpv come to mind). In this case the little wrapper app “coffeine” comes in handy (source). Download the latest .deb file and install it with

sudo dpkg -i ./coffeine*.deb

Use it just by prepending it to the application you want to execute, e.g.

coffeine apt dist-upgrade

and the screen will stay on while you upgrade your system and won’t suspend in between.
UPDATE: Disclaiimer, it was written my me, so this is a shameless self-plug.

10 Likes

I thought distribution upgrades do that automatically but there definitely are situations where this would come in handy.

There are many situations beyond system upgrades, e.g. watching a video with mpv where this is useful. Besides, I am not sure that mobian or PureOS prevent the sytem from suspending while apt runs.

Is there somewhere upstream that you can put in a pull request so that this can be incorporated in core system functionality? Perhaps some interpreter/wrapper/coreutils project in PureOS?

I would hope this functionality makes it’s way into Phosh eventually so this tool isn’t needed, but this is good to have for now and I was happy to read through the code and see how this sort of this is handled. Thanks!

Maybe not. My comment, poorly specified, was in response to “the screen will stay on”.

kinda’ like what the “inhibit hybernation” checkbox does from the “Transmission GUI-client > Preferences > Desktop” does

Exactly that, just that this works with those apps that do not have support built in.

2 Likes

To be honest, the support for that IS in phosh, that is why I can make use of it so easily. And apps that request a disabled screensaver will get it. My tool is just a hack for those programs that have no support for this built in, such as the mpv video player. Ideally, these apps should simply request the Inhibitor themselves.

4 Likes

if i’m not mistaken Transmission uses the C language for it’s code … maybe you could adapt yours to NOT be just “a hack for those programs that have no support for this built in”

nevertheless i’m probably going to use this at some point or the other … much appreciated :slight_smile:

Keeping the screen on is in the power setting as is other related settings for it. So you have a proper gui option for setting how long it takes for it to turn off the screen from inactivity, one of it’s options is never. the setting is called “blank screen” in the power settings.

Edit: Auto Suspend is also there, but it’s off by default, sorry for the edit, i did not notice till just now.

yes but that is a setting that once activated is applied with NO EXCEPTIONS. perhaps the OP was looking for a way to KEEP that setting ON while ALSO being able to enforce an exception … i know that’s what the Transmission GUI setting does (it’s an exception)

1 Like

Err, I DO NOT WANT to disable the sreen saver per se and modify the overall suspend policy. I do not want it to engage WHILE A SPECIFIC PROGRAM is running, like the movie player mpv. After the movie has ended, the screen should blank again as set in the settings section.

3 Likes

I saw no settings allowing for a white and or black list to allow you to have a different setting for when marked applications are active. I’m sorry for the misunderstanding, someone pointed me to this for it in general.

2 Likes

no problem, things are easy enough to misunderstand :-). So, I apologize for apparently having expressed myself not clear enough. :wink: :peace_symbol:

Yknow, there’s a gnome extension called caffeine that does something similar. You have to manually turn it on and off, though. If you could add your functionality to it such that it has a whitelist and/or blacklist, it would be pretty awesome.

Just for the record. I retired coffeine after I discovered that:

gnome-session-inhibit --inhibit-only

and

gnome-session-inhibit  <CMD>

do the same and are preinstalled on mobian (and perhaps PureOS?)

Also systemd-inhibit can prevent blanking/suspending/shutdown.

1 Like

hold on … isn’t there a config file to ‘white-list’ a couple of programs that when running should modify the default power-options behavior ? screen-blanking, suspend, etc. ?

That command exists on the Librem 5.

No, nothing of that kind exists to my knowledge. Each app is responsibel to suspending the screensaver by holding an “inhibitor”.