You are not logged in.

#1 2017-08-29 09:41:54

justasug
Member
Registered: 2014-08-03
Posts: 165

Firefox-DPMS - disable DPMS screen blanking when playing videos

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.

Turns off DPMS blanking when Firefox is playing back video.

https://github.com/dglava/firefox-dpms

I have been looking for a way to turn off all DPMS settings when watching videos in my web browser (Firefox). For example when watching YouTube videos. There is lightsOn, but that didn't work like I wanted it to.

The idea is to use Pulseaudio to determine when Firefox is playing back a video. When it does, a Pulseaudio sink shows up with Firefox's details. This allows one to toggle DPMS settings when that happens. Compared to lightsOn and similar scripts, it does not perform a check every number of seconds. Instead it waits for Pulseaudio events and checks based on that.

I am aware that it's basically an ugly hack, but I find it better than the other solution (lightsOn) I found. I am also not sure if this was the best way to implement it, perhaps a simple shell script could do the same (with pactl subscribe). so suggestions are welcome.
There's a basic PKGBUILD in the git repository, but I might improve it and add it to the AUR later.

Last edited by justasug (2020-02-27 13:13:45)

Offline

#2 2017-08-30 22:03:12

monodromy
Member
Registered: 2014-02-08
Posts: 62

Re: Firefox-DPMS - disable DPMS screen blanking when playing videos

Just out of curiosity, why don't you like lightsOn? Is it just that it checks periodically?

Offline

#3 2017-08-31 07:44:09

justasug
Member
Registered: 2014-08-03
Posts: 165

Re: Firefox-DPMS - disable DPMS screen blanking when playing videos

LightsOn works only by detecting Flash video. I needed something to work with HTML5 video. I think there are forks of lightsOn which support that, but I only tried 1 which didn't work and finding the others is tedious. I don't really have problems with the periodic checks, it's just that this method happened to be slightly more convenient (I assume it's also more "effective", but I don't think one simple check every minute or so would be too tasking on the CPU).

I would love if Firefox and other programs handled this themselves. That there would be a common way for them to signal "I want you to turn off screen saving", via dbus or something and which would toggle DPMS settings too. But I haven't found such a solution. Is there one?

Offline

#4 2017-08-31 19:19:56

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,914
Website

Re: Firefox-DPMS - disable DPMS screen blanking when playing videos

firefox has an indicator for sound. It shows a volume icon on the tab in that case. Should be possible to detect this with an extension


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

#5 2017-08-31 21:16:04

progandy
Member
Registered: 2012-05-17
Posts: 5,192

Re: Firefox-DPMS - disable DPMS screen blanking when playing videos

That is a really neat idea. Screensaver inhibition would be nice, though. Maybe an option to run a user defined command in addition to dpms?

Rasi wrote:

firefox has an indicator for sound. It shows a volume icon on the tab in that case. Should be possible to detect this with an extension

You'll still need the systemd service, since Firefox is moving to the chrome way with webextensions. addons won't have access to the OS anymore without a daemon providing access with some sort of rpc server.

Last edited by progandy (2017-08-31 21:22:25)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#6 2017-09-01 12:19:48

justasug
Member
Registered: 2014-08-03
Posts: 165

Re: Firefox-DPMS - disable DPMS screen blanking when playing videos

Rasi wrote:

firefox has an indicator for sound. It shows a volume icon on the tab in that case. Should be possible to detect this with an extension

I'm afraid I don't have any knowledge about Firefox extensions (looks like they need JavaScript knowledge).

progandy wrote:

That is a really neat idea. Screensaver inhibition would be nice, though. Maybe an option to run a user defined command in addition to dpms?

That sounds reasonable. I'll look into adding that.

EDIT:
Added the ability to run custom commands. See the README or --help.

Last edited by justasug (2017-09-01 13:33:48)

Offline

Board footer

Powered by FluxBB