Smarter Screen saver

Daniel Stone daniel.stone at ubuntu.com
Sun Oct 2 11:32:55 CDT 2005


On Tue, Sep 20, 2005 at 09:15:51PM +0100, Stephen Shirley wrote:
> Daniel Stone wrote:
> >On Tue, 2005-09-20 at 13:39 +0100, Stephen Shirley wrote:
> >>The proper way to do this is to have apps such as totem notify
> >>gnome-screensaver that it should not engage when a movie is playing.
> >>That's fairly simple to do (and i'd be surprised if it hasn't been done).
> >
> >Actually, it's not really easy to do at all, especially if you want to
> >do it properly, and not just a gnome-screen-saver-specific hack.
> >There's a reason why mplayer has a non-trivial amount of code dedicated
> >to faking key events to itself when a movie is playing.
> 
> Ok, with that in mind, i'll re-state ,-) It should be easy to define a 
> standard for this, and, if the standard is designed sensibly, it should 
> be easy to add support for it to all the relevant packages. If this is 
> indeed the case (i don't know the details of how it all works, so this 
> is just a guess), and if people are interested, i'd be happy to do that 
> for say dapper drake. It's probably something that would fall under the 
> freedesktop.org remit. Comments?

Not really fd.o standard material, I think.

I got bored over the weekend and implemented this:
    * each blanking cycle, xscreensaver parses the _SCREENSAVER_DISABLE
      property on the root window, which is a list of window IDs;
    * it prunes invalid window IDs[0];
    * if the list is non-empty, it doesn't blank.

So, if you want to disable the screensaver, you simply add your window
ID to _SCREENSAVER_DISABLE.  This means it's safe for multiple programs
to do at once without any badness (applications A and B start and both
disable screensaver, app B exits and re-enables it, screensaver kicks
in while A is still running, despite A having disabled it) with
multiple applications, and the pruning described means you don't get
your screensaver still disabled when your video player of choice
crashes.

It's simple enough that I don't think it needs to be defined by any
standard.  Although given that xscreensaver is now apparently
maintainerless, getting it standardised across all the xscreensaver
distributions might be tricky ...

Cheers,
Daniel

[0]: Think: mplayer starts, sets the property, crashes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.ubuntu.com/archives/ubuntu-devel/attachments/20051003/1271deea/attachment-0001.pgp


More information about the ubuntu-devel mailing list