/firefox-dpms

Disable DPMS settings when playing video in Firefox

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Firefox-DPMS

Disables DPMS (screen blanking) when Firefox is playing back video.

NOTE: as of Firefox 71 (perhaps even earlier versions) automatic disabling of screensaver/DPMS works out of the box, without any additional screensaver running. Basically this hacky solution is useless now.

NOTE: this is a hacky way to solve the problem. A better approach would be utilizing the org.freedesktop.ScreenSaver dbus interface. I have no plans right now to work on it, hopefully someone else will.

I couldn't find a way to make Firefox suspend the DPMS settings when it was playing back videos on a website (YouTube for example). This accomplishes exactly that, but in a hacky way.

It works by checking if there are audio streams coming from Firefox with Pulseaudio. The idea is that when you're watching videos, audio is also present. When it detects Firefox audio, it turns DPMS off and restores it again when Firefox's audio disappears, i.e.: the video is closed.

How to install

Run $ python setup.py install
It requires python-pulse-control and obviously Pulseaudio. Arch Linux users can install it from the PKGBUILD in the AUR.

How to use

  • Run $ firefox-dpms

You can specify an additional command to be run alongside the DPMS settings change. For example you can toggle additional screensavers. Use:

  • -c or --command-on to run it when video/audio streams are detected
  • -o or --command-off to run it when streams stop