> Hans,
>
> I was not aware of that specification, thanks for bringing to to my
> attention. I will work on it.
>
> Kevin
Hi Kevin-
I researched this a bit further, and it seems that Gnome does not yet
implement that spec. It seems that for the moment screensaver
en/disabling is desktop environment specific. Or that you could hope
that the desktop does the right thing with those XScreenSaverSuspend()
calls.
I think gnome-mplayer should correctly disable screensavers even when
not run under Gnome. Would you agree?
Possibilities:
* implement org.freedesktop.ScreeenSaver as well, so non-gnome desktops
can do the right thing
* use the standard xdg-screensaver script. It is part of freedesktop's
xdg-utils package. It is bash and if you review the code you see that it
tries to determine the current desktop and use whatever method seems
appropriate.
I think the code inside gnome-mplayer which handles the screensaver
should try to determine the correct method itself. How about something
like this:
You have a bunch of functions, each of which tries one method to toggle
the screensaver. So you have
bool switch_screensaver_gnome_screensaver(gboolean enabled);
bool switch_screensaver_gnome_sessionmanager(gboolean enabled);
bool switch_screensaver_freedesktop_screensaver(gboolean enabled);
bool switch_screensaver_xdg_screensaver(gboolean enabled);
The boolean return value tells you if the function thinks it managed to
actually do something. For instance, if the dbus call succeeded, or if
it could find the xdg-screensaver executable. Then the main switch
function would look like so:
bool switch_screensaver(gboolean enabled) {
if(switch_screensaver_gnome_screensaver(enabled)) {
return true;
}
if(switch_screensaver_gnome_sessionmanager(enabled)) {
return true;
}
if(switch_screensaver_freedesktop_screensaver(enabled)) {
return true;
}
if(switch_screensaver_xdg_screensaver(enabled)) {
return true;
}
return false;
}
You could even try and fit the XScreenSaverSuspend() call into this
chain as a method of last resort. But I don't know the history of this
code in gnome-mplayer. What prompted you to make it a config option?
Cheers
Hans