How to keep applications from preventing automatic power management
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:
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.)
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.
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.
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:
- I like to fall asleep to a playlist on Youtube, which requires me to start a manual sleep-timer.
- 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.
- 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)
- 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.