Red Hat Bugzilla – Bug 529287
Last modified: 2010-02-28 18:47:52 EST
When xdg-open thinks that it runs in a gnome session, it uses gnome-open.
There is two problems here:
- In the last few gnome releases, gvfs-open is the commandline tool of choice.
- The way the gnome session detection works is by looking for a GNOME_DESKTOP_SESSION_ID env var. This does still work with current gnome-session, but the variable is set to 'this-is-deprecated'. A better way to detect a gnome session nowadays is to look for org.gnome.SessionManager on the session bus.
I've been meaning to ask you about stuff like that and you pre-empted me. Thanks!
I'll make sure these fixes land soon.
Do you offhand when support for gvfs-open and org.gnome.SessionManager landed in gnome? and whether support for the deprecated items can (or should) be dropped?
Otherwise, I suppose we could just be safe and try the new methods, and fallback to the older ones on failure.
gvfs-open appeared in 2.22, I think and the session manager dbus interface in 2.24. But I don't think dropping the old ways of doing things is necessary. You can just look for gvfs-open and prefer it over gnome-open if found.
For the gnome detection, looking for the dbus interface is preferable over the env var, since e.g things that are activated on the session bus will not have the deprecated env var in their environment, I think. If any such activated app were to use xdg-open, it would not realize it was running under gnome.
OK, my dbus-send-fu is a bit lacking, but would checking output or error code of something like the following suffice as a good check for org.gnome.SessionManager existing on the bus:
dbus-send --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager org.freedesktop.DBus.Introspectable.Introspect
better suggestion on irc:
[11:16] <walters> rdieter: dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager
* Fri Oct 16 2009 Rex Dieter <email@example.com> - 1.0.2-14.20091016cvs
- prefer gvfs-open over gnome-open (#529287)
- DE=gnome, if org.gnome.SessionManager exists on dbus (#529287)