Replace DE open command in favor of xdg-open

Mark Doliner mark at
Wed Jan 13 05:29:10 EST 2010

2010/1/10 Jorge Villaseñor <salinasv at>:
> 2010/1/7 Mark Doliner <mark at>:
>> 2010/1/5 Jorge Villaseñor <salinasv at>:
>>> Talking with a friend of mine we realized that it could be a good idea
>>> if pidgin/libpurple (does this must be front or back end issue?) uses
>>> just xdg-open instead of asking if the user uses gnome or kde to open
>>> URIs with their specific command.
>>> Then, talking with darkrain about this issue, we noticed that there
>>> are some code duplication regarding open files and URIs.
>>> I was about to try to elimiate this code duplication but I want to ask
>>> if there is some reason I'm not aware to not use xdg-open and
>>> eliminate the DE specific commands and maybe the need of DE detection?
>>>  AFAIK each DE is suppoused to set the xdg variables so xdg-open can
>>> fetch the right program. It also help people using some DE different
>>> from kde and gnome, or not using a DE (people who uses awesome).
>> Is this in reference to the pidgin_notify_uri() function in
>> pidgin/gtknotify.c?  Have GNOME and KDE always set the appropriate xdg
>> variables?  If older versions of GNOME did not set them and you remove
>> the GNOME-specific and KDE-specific code, it seems like it would harm
>> any users who may be using those older versions.
>> And it's not clear to me how removing that code would help people not
>> using kde/gnome... we already attempt to use xdg-open, don't we?
>> Could you explain?
>> --Mark
> Actually I was referring to file_open_uri() in gtkutils.c since it
> perform the gnome/kde checks and if both fail it call
> purple_notify_uri() wich perform the same checks.

Ah, I didn't realize that existed.  It does seem a bit weird to have
such similar code in two places.  We could try removing the code from
gtkutils.c, but we'd probably want to look at it very careful and make
sure there aren't desirable differences in file_open_uri().  It seems
like the gtkutils code might be targeted at running an application,
whereas the gtknotify code might be targeted at opening a web page.

> After some research I found that xdg-open actually calls
> gvfs-open/gnome-open, kfmclient, exo-open for gnome, kde and xfce and
> mimeopen for a "custom" DE, so it's safe to skip all DE checks in
> pidgin/purple itself and just let xdg-open do the job. It also helps
> not using kde/gnome because it support xfce and fallback to mimeopen
> which pidgin does not in the current implementation. It also can help
> to avoid different code for each uri handler since all of them can
> just call xdg-open.

But are there old systems that might have gnome-open but not xdg-open?
 It doesn't hurt us much to remain backward compatible with them.

> I also noticed that pidgin_notify_uri() have a lot of code handling
> different browsers but the preferences dialog just set Firefox,
> Desktop Default and Manual. I guess we can just delete all that stuff
> not handled by prefs. Maybe delete the Firefox entry and add a FAQ
> about setting the right browser in DE config or the BROWSER env
> variable.

I believe the preference dialog only displays browsers which are
available on your system, but it supports more of them, and all
supported browsers would need to be listed in gtknotify.

> I think is a good  idea to avoid anything DE specific. (will try to
> take a look at each call of running_gnome() and running_kde() )

I agree, in an ideal world Pidgin wouldn't need to behave differently
depending on which DE the user is using.  But I think we should be
careful not to reduce compatibility/functionality.


More information about the Devel mailing list