1

System: Ubuntu 16.04, Unity

Main question: How do I prevent an application from preventing automatic suspend?

Particular issue: Youtube videos playing in Firefox will prevent automatic suspend of the screen and system.

I know many people want this, but I do not want this to happen unless I specifically indicate it.

Secondary questions/observations:

  1. What services or programs are responsible for triggering automatic screen and suspend actions? gnome-screensaver?

    • It is not DPMS. DPMS is not configured to do anything by default. When I do set DPMS to do something, it will ignore video playback for its automatic screen dimming. (The settings will be reset on every suspend-resume or reboot.)
  2. Is there a way to monitor the inactivity timer?

    • Video playback does not actually reset the inactivity counter, but just prevents automatic suspend, so when the video ends, the system will go to sleep immediately, provided a sufficient period of inactivity.
  3. How is this behaviour implemented? Is it some sort of "dont sleep"-state any program could indicate to the system or is it a specific function in Unity to detect HTML5 video playback?

    • As described above, it is different than "faking" activity, like Caffeine does.
  4. Is there a way to find out if a given program is preventing automatic suspend?

    • I would like to know ahead of time how e.g. a new media player will affect automatic suspend without having to run tests whose outcome might be distorted by other running applications.

Note: I have posted a similar question on this German board.

Edit: My reasons:

  1. I like to fall asleep to a playlist on Youtube, which requires me to start a manual sleep-timer.
  2. When I want a short task to finish and leave my computer, I want it to go to sleep after a while, but even a paused Youtube video has kept my computer and screen awake all night on several occasions.
  3. If I actually want to watch a longer video I have to start Caffeine anyway, because I have no easy way to tell whether Firefox is actually preventing power management for this specific video site (it seems not to happen for Flash videos at all). I'll take predictable over occasionally convenient behaviour. (I also dislike the system going to sleep immediately after a video ends, as described above)
  4. In general, for any application, I have no way of knowing whether an application is preventing suspend right now or is ever going to, as there is no indication of this behaviour in any system or application settings.
5
  • How is Firefox to know if a human is watching the videos (don't suspend) or not (okay to suspend)? Personally, I find the system suspending in the middle of a movie very annoying, and I'm glad applications can override the default timeout. The short answer to most of your questions is 'Power Manager' and 'communicates using dbus'.
    – user535733
    Jun 3 '17 at 15:50
  • So is there a way to either tell the Power Manager to ignore this override or to disable it in Firefox?
    – hife
    Jun 3 '17 at 22:33
  • To answer your question: I do not want Firefox to know anything, I want Firefox to let me tell it what to do. I know many people like this behaviour and I'm not telling anyone to change the defaults, I just want my personal system to behave differently. For my reasons, see the edited post.
    – hife
    Jun 3 '17 at 23:05
  • Since Firefox has no such setting (that I know of), you must test and change the setting in Power Manager each time...or use a different browser. Testing requires a knowledge of dbus. Testing each time requires a knowledge of scripting.
    – user535733
    Jun 3 '17 at 23:32
  • Alright, as long as there is a way to counteract the setting in Power Manager, I can just use a script with a loop and a switch to get it done. It's not a perfect solution, but a usable workaround. Thank you. Now to learn some dbus commands. I will update this post with my progress.
    – hife
    Jun 4 '17 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.