In Firefox 38.8.0 ESR, under Debian Lenny with GNOME 2, I discovered that the application associated via XDG (described in the answer by the OP) is used only when opening a downloaded file from Downloads in the Library.
And even there, the implementation gives results inconsistent with
xdg-open as it ignores GNOME-specific paths (in my case
/usr/share/gnome/applications/defaults.list, which is a symlink to
/etc/gnome-vfs-2.0/defaults.list). I had to specify
application/pdf=evince.desktop in my
~/.local/share/applications/defaults.list. (Note that
defaults.list was merged in
mimeapps.list in more recent versions of XDG.)
Instead of XDG, metamail capabilities (mailcap) are used to resolve the associated application for the following use cases:
- opening downloaded file from the download panel (displayed after pressing the download button in toolbar)
- default application in the drop-down in file download dialog
- default application in the drop-down in Preferences → Applications (
The preference in
about:preferences#applications is used when navigating to an URL with that content type, unless download is forced.
Mailcap is a mechanism older than XDG and has its roots in e-mail, where MIME comes from, too. The
run-mailcap utility is analogical to
xdg-open. Its configuration comprises three files (in decreasing precedence):
~/.mailcap — user entries
/etc/mailcap.order — system-wide entries ordering specification
/etc/mailcap — system-wide entries (same format as user entries)
Together they produce a list of one-line entries that specify the application to be used for any given MIME type. The entries are matched top-down, so what comes first takes precedence.
To make a system-wide change of entries precedence, you need to edit
/etc/mailcap.order and run
To override some of the entries or specify your own, system-wide, you need to edit the top section (meant for manually created entries) of
/etc/mailcap and run
update-mime. See the comments in the top section.
For user entries and overrides, use
~/.mailcap. The changes take effect immediately. No
~/.mailcap.order exists; if you want to change entries precedence, reorder them physically (if they are in
~/.mailcap), or override them with the preferred version (if they are in
man mailcap and
Note that some applications use generic utilities (such as
pager) instead of detection of the preferred application. You may need to use
update-alternatives or a similar mechanism for choosing the preferred implementation of a generic utility in your distro. Or, to override a system-wide preferred alternative for a specific user, set environment variables such as
BROWSER. They are supported by
sensible-browser and other, often more specific tools (e.g.
git commit uses