“When I see professional clowns, mimes, or people who makes ballon animals, I think of their relatives and how disappointed they must be.”

The determination of what application handles what kinds of files or links is another one of those areas that seems to have been taken over by the folks at freedesktop.org, who obviously believe there can never be enough layers of abstraction between you and the thing they want to prevent you from configuring.

All programs which bow down to freedesktop.org invoke the xdg-open script to start the appropriate application for the link or file they are passing. This is a shell script, so you can read it to partially decrypt the first layer of abstraction. You will discover that it attempts to determine which desktop you are running so it can invoke the next layer of abstraction. If (like me) you hate all the “standard” desktops and you aren't running one of them, then the guess xdg-open makes will always be wrong. You can induce it to make the right (or at least a consistent) guess by setting the XDG_CURRENT_DESKTOP environment variable like so:

XDG_CURRENT_DESKTOP="GNOME"
export XDG_CURRENT_DESKTOP

Note that this needs to be set early in your X session startup so that it will be inherited by everything which might want to examine it. I put it in the ~/.xsession file I use to start my non-standard desktop.

By forcing xdg-open into the path of gnomes, we simplify the determination of what happens next, and that is the use of either gvfs-open or gnome-open. These are binary executables, so finding out what happens next is harder, but google searches lead to the /usr/share/applications/ directory. That directory contains a mimeinfo.cache file which is apparently constructed from the mime info scattered around in all the .desktop files in that same directory.

The cache file is full of junk that looks like this:

application/x-cd-image=brasero.desktop;mount-archive.desktop;kde4-ark.desktop;kde4-k3b.desktop;gnome-file-roller.desktop;

That happens to be the line which determines what to do with iso image files. Note that there are lots of different programs that handle iso images, and only one is listed first. In my experience, the odds are huge that the wrong one will be listed first, so xdg-open will invoke the wrong program.

I just found this web page that has more info than I've been able to deduce here, but it adds more confusion. There is apparently a defaults.list file as well as a mimeinfo.cache file, and now I'm completely lost since I can't figure out which one is used for what (and the contents aren't always completely redundant either). Let's do some experimenting...

Apparently the ~/.local/share/applications/mimeapps.list file can be used to override both of those system global files. You can include up to 3 different sections in the mimeapps.list file: [Added Associations], [Removed Associations], and [Default Applications]. As near as I can tell the first two override the mimeinfo.cache file and the last one overrides the defaults.list file.

 
Game of Linux Entry Game of Linux Site Map Tom's Fabulous Web Page
 
Page last modified Sun Sep 2 12:41:24 2012