[vlc-devel] [PATCH] Add dpms module to switch it off while playing

Rémi Denis-Courmont remi at remlab.net
Fri Oct 25 21:42:54 CEST 2013

Le vendredi 25 octobre 2013 21:01:06 Olivier Brunel a écrit :
> On 10/25/13 20:51, Rémi Denis-Courmont wrote:
> >    Hello,
> > 
> > The DPMS extension of X11 is meant for the desktop power management
> > component to use, not for normal applications. Changing DPMS settings via
> > xset, Xlib or XCB would clobber the desktop settings, which is obviously
> > *not* acceptable.
> > 
> > Normally, the desktop should automatically disarm and rearm DPMS when the
> > screensaver is inhibited and uninhibited respectively. If it does not,
> > then it is a the bug in the desktop environment. There are no ways to fix
> > this problem in VLC for lack of a proper API.
> Well, as I said the right thing to do would have been to call
> xdg-screensaver,

That is what VLC already does - if D-Bus probing fails. And better yet, LibVLC 
also does it; it does not depend on the VLC playlist.

> but for that I would have needed to send it the window
> ID, which I don't know how to get from VLC.

That is not true. xdg-screensaver has two modes. Only one of them, 
suspend/resume, requires a window ID. The reset mode does not, and that is 
what VLC uses. In fact, reset turns out to be more reliable as suspend/resume 
had a propensity to leave dangling processes around.

> And since (in my specific setup) that call would pretty much call xset,

Your specific setup is not the setup of other people. This patch is not 
acceptable as is and that is the end of it.

> I did that directly. If the window ID can be obtained, calling
> xdg-screensaver suspend/resume would be a better solution of course.

The only theoretical advantage of suspend/resume over reset is enabling xdg-
screensaver to keep the D-Bus connection open (which some screensavers 
require). But since xdg-screensaver is so far a shell script, that advantage 
remains wholly theoretical.

On the other hand, reset has the advantage of not depending on xprop, not 
requiring a persistent process and not being tied to X11.

Rémi Denis-Courmont

More information about the vlc-devel mailing list