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 default application to be used for a given mimetype. This is for instance the one that will be started when double-clicking on a file in a file manager. If the application is no longer installed, the next application in the list is attempted, and so on.

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 should pick the most-preferred .desktop files associated with the mimetype, taking into account added and removed associations as per the previous section.

The suggested algorithm for determining the default application for a given mimetype is:

Note that, unlike adding and removing associations, a desktop ID set as the default for an application can refer to a desktop file of the same name found in a directory of higher precedence.

Note as well that the default application for a given type can be an application that is not associated with this type (ie: neither by MimeType= or an added association, or even in the case that the association was specifically removed). Such configurations should be regarded as unusual, however, and implementations should not write mimeapps.list files that create this circumstance.