From: PCMan <pcm...@gm...> - 2010-09-15 01:37:05
|
So here is the design choice. To implement locking program detection in script and depends on dbus-send, or to implement this in C code to have no other dependencies since we already use dbus? Maybe this time doing it in C can make things easier than using scripts. Suggestions? On Wed, Sep 15, 2010 at 5:26 AM, Guido Berhoerster <gui...@be...> wrote: > * PCMan <pcm...@gm...> [2010-09-14 22:46]: >> On Wed, Sep 15, 2010 at 4:19 AM, Guido Berhoerster >> <gui...@be...> wrote: >> > * PCMan <pcm...@gm...> [2010-09-14 15:48]: >> >> > No, running "gnome-screensaver-command -l" without >> >> > gnome-screensaver running will print >> >> > **Message: Screensaver is not running! >> >> > and return exit code 1. >> >> This is not the case on my box. >> >> It tried to launch gnome-screensaver even if this command failed. >> >> I'm using ubuntu 10.04. >> >> >> >> Please read the source code of gnome-screesaver-command. >> >> Is doesn't do what you said. >> >> >> >> http://git.gnome.org/browse/gnome-screensaver/tree/src/gnome-screensaver-command.c >> >> >> >> It exit with code 1 only when you pass wrong arguments, when dbus is >> >> not available, and when you query the version number. >> >> It return 0 even if gnome-screensaver is not running. >> >> The dbus call, however, will cause the gnome-screensaver service being launched. >> >> I don't know the version of gnome-screensaver you're using, but from >> >> the latest code in git, it doesn't not work the way we want. >> > >> > I admit you are right on this one, the DBus autostart seems to >> > have been introduced in April: >> > http://git.gnome.org/browse/gnome-screensaver/commit/?id=47155576403fea9339a1f702e3dc63455b763fb8 >> > >> > They more or less silently changed the behavior of >> > gnome-screensaver-command breaking shell scripts (including one >> > of mine for inhibiting the screensaver while running an >> > application) relying on the previous behavior which was modeled >> > after xscreensaver-command, just lovely. >> >> Since they do things with the dirty way, here is a dirty solution I >> came up with. >> >> dbus-send --session --type=method_call --print-reply >> --dest=org.freedesktop.DBus / org.freedesktop.DBus.NameHasOwner >> string:"org.gnome.ScreenSaver" >> >> Maybe this command line can do the trick. > > The problem is that dbus-send might not necessarily be installed > even when dbus itself is. > >> > If someone has gnome-screensaver installed and is running another >> > screensaver I don't see any way to tell from a shellscript which >> > one to use now. Looking for a process is just plainly broken and >> > unreliable by principle, e.g. someome might suspend before the >> > session has started gnome-screensaver, see >> > https://bugzilla.gnome.org/show_bug.cgi?id=616225 >> But this should be a rare case. Maybe we should ask gnome-screensaver >> developers how to solve this. > > I think that is the proper solution. > > -- > Guido Berhoerster > |