[Portland] Re: xdg-open and default application launching

Logan Rathbone rathbonel at phoenuxos.com
Fri Apr 20 12:11:42 PDT 2007


(Sorry I'm unable to reply to this thread the "proper" way -- I've just 
subscribed to the list now).

Being a developer/packager for a new distribution called PhoeNUX OS, 
part of what I've been trying to do is integrate GNOME apps with KDE as 
much as possible, since we only support the KDE desktop but include the 
GNOME libraries and some applications.  One of the main thing this has 
included is a solid "default web browser" and "default email client" 
system.  I think the Portland project is GREAT and I'd like to be able 
to help out with it if possible.

I think the x-default/ MIME type sounds like a very good idea, but the 
current implementations of "preferred applications" will still need to 
be kept in mind.  So x-default/webbrowser, for instance, when set, would 
need to also set the defaults for all desktops installed on the system 
as well.

KDE, for instance, uses BrowserApplication=... in kdeglobals to define 
the default web browser.  This can be a .desktop file or an executable 
(hopefully a .desktop file).

GNOME, I'm a little less familiar with.  I know that they use the GConf 
key "/desktop/gnome/applications/browser/exec" but gnome-open uses 
"/desktop/gnome/url-handlers/http(s)/command" (iirc).  Plus I'm not sure 
if there can be a .desktop file specified there.  So it's a bit of a 
tricky question there, and someone more informed than I would probably 
have to step in and say what the "right thing" to do would be on GNOME.

Setting default email clients is trickier.  On KDE it's not too 
difficult, you just have to populate "EmailClient=..." in emaildefaults 
with a string saying how to execute a full mailto-ish command with that 
specific client (it varies quite a bit, actually).  This can then be 
accessed via the invokeMail (iirc) API in kdecore, or with the 
kmailservice command. This creates a visible problem almost immediately: 
  how do you handle the situation where the commands are very different 
for invoking a mailto-ish command in any given email client, and just 
opening that client normally?  The clients tend not to be very forgiving 
with commands like "thunderbird -compose 
to=,subject=,body=,cc=,bcc=,attachment=" -- that one opens a blank 
compose window in TBird, for instance.

So with my "runmail" script (basically just launches the default email 
client in kmailservice/invokeMail without any arguments) on my distro, I 
use some pretty bad hacks... I strip the arguments from the EmailClient= 
line, and if left with "mozilla" or "seamonkey," I append "-mail" to the 
command and run it.  So it's pretty bad.

So as you can see, there are some pitfalls with the MIME method.  Even 
if it were implemented in a unidirectional way (ie: the xdg-utility sets 
the x-default/webbrowser mimetype and then sets the KDE3/GNOME2 default 
web browsers), how would you handle the situation where someone does the 
opposite, and opens up KControl and sets their default web browser to 
something else?  How is xdg-utils supposed to handle that?

OK I think that should be enough to hopefully spark a discussion... I've 
really got my heart set on getting this preferred applications stuff 
"sorted out" -- I'd really like to see the day when Firefox can set the 
default web browser and actually have it do something for non-GNOME 
users, for example (and no, overriding the check and reimplementing a 
kdialog script doesn't count ;)

--Logan


More information about the Portland mailing list