This specification solves the remaining issues: which application should open a file by default, how to let the user change the default application, and how to let the user add or remove associations between applications and mimetypes.

File name and location

Users, system administrators, application vendors et distributions can change associations between applications and mimetypes by writing into a file called mimeapps.list.

The lookup order for this file is as follows:

$XDG_CONFIG_HOME/$desktop-mimeapps.list

user overrides, desktop-specific (for advanced users)

$XDG_CONFIG_HOME/mimeapps.list

user overrides (recommended location for user configuration GUIs)

$XDG_CONFIG_DIRS/$desktop-mimeapps.list

sysadmin and ISV overrides, desktop-specific

$XDG_CONFIG_DIRS/mimeapps.list

sysadmin and ISV overrides

$XDG_DATA_HOME/applications/$desktop-mimeapps.list

for completeness, deprecated, desktop-specific

$XDG_DATA_HOME/applications/mimeapps.list

for compatibility, deprecated

$XDG_DATA_DIRS/applications/$desktop-mimeapps.list

distribution-provided defaults, desktop-specific

$XDG_DATA_DIRS/applications/mimeapps.list

distribution-provided defaults

In this table, $desktop is one of the names of the current desktop, lowercase (for instance, kde, gnome, xfce, etc.)

This is determined from the environment variable $XDG_CURRENT_DESKTOP, which is a colon-separated list of names that the current desktop is known as.
The $desktop variable should be each of these values in turn.

All of the above files are referred to as "mimeapps.list" in the rest of this specification, for simplicity.

Default Application

Indicating the default application for a given mimetype is done by writing into the group [Default Applications] in the file mimeapps.list.

The [Default Applications] group indicates the preferred application for a given mimetype. This is for instance the one that will be started when left-clicking on a file in a file manager. If the application is no longer installed, the next application in the list is used.

This example ensures that the application default1.desktop will be used for mimetype1, if it's installed, and otherwise default2.desktop if it's installed:

[Default Applications]
mimetype1=default1.desktop;default2.desktop

The value is a semicolon-separated list of desktop file IDs (as defined in the desktop entry spec).

In the absence of such an entry, the next mimeapps.list is checked. Once all levels have been checked, if no entry could be found, the implementations can pick any of the .desktop files associated with the mimetype, taking into account added and removed associations as per the next section.

Adding/removing associations

Adding and removing associations between mimetypes and applications is done with the following syntax in the mimeapps.list file: