The freedesktop.org MIME Applications Associations specification specifies how to determine which application should open a file by default.
This specification solves the related issue of how to determine the default application to use for cases where there is not an associated MIME type, including which terminal to use when launching applications in a terminal as specified in the freedesktop.org Desktop Entry specification.
The locations of the configuration files for default applications mirror the locations of the mimeapps.list file from the MIME Applications Association specification.
Users, system administrators, application vendors and distributions can change default applications by writing into a file called defaultapps.list.
The lookup order for this file is as follows:
$XDG_CONFIG_HOME/$desktop-defaultapps.list |
user overrides, desktop-specific (for advanced users) |
$XDG_CONFIG_HOME/defaultapps.list |
user overrides (recommended location for user configuration GUIs) |
$XDG_CONFIG_DIRS/$desktop-defaultapps.list |
sysadmin and ISV overrides, desktop-specific |
$XDG_CONFIG_DIRS/defaultapps.list |
sysadmin and ISV overrides |
$XDG_DATA_DIRS/applications/$desktop-defaultapps.list |
distribution-provided defaults, desktop-specific |
$XDG_DATA_DIRS/applications/defaultapps.list |
distribution-provided defaults |
In this table, $desktop is determined in the same way as in the MIME Applications Association specification.
All of the above files are referred to as "defaultapps.list" in the rest of this specification, for simplicity.
An "intent" is an abstraction of a type of application that the user wishes to open for a particular purpose. An intent should correspond to an Additional Category from the freedesktop.org Menu specification. However, the reverse is not true. Not all Additional Categories are intents, as some are too generic to be for a particular purpose.
[app-a] contains a registry of available intents.
When presenting the user with a list of possible applications for an intent, it is recommended to find applications which are associated with the corresponding category.
Indicating the default application for a given intent is done by writing into the group [Default Applications]
in the defaultapps.list file.
The [Default Applications]
group indicates the default application to be used for a particular intent. For instance, opening a calculator application when a calculator keyboard key is pressed, or starting a terminal in which to launch a terminal-only application. If the application is no longer installed, the next application in the list is attempted, and so on.
This example ensures that application default1.desktop will be used for the calculator, if it’s installed, and otherwise default2.desktop if it’s installed.
[Default Applications] Calculator=default1.desktop;default2.desktop;
The value is a semicolon-seperated list of desktop file IDs (as defined in the desktop entry spec).
In the absense of such an entry, the next defaultapps.list is checked. Once all levels have been checked, the system may either attempt to find a suitable application that is installed, use a hard-coded default application, or abort. In the case of an abortion, it is recommended that the system inform the user that no suitable application is installed.
Intent | Notes |
---|---|
Calendar |
|
ContactManagement |
|
Dictionary |
|
Fallback to default application for x-scheme-handler/mailto MIME type |
|
Presentation |
|
Spreadsheet |
|
WordProcessor |
|
Scanning |
|
Printing |
|
PackageManager |
|
Chat |
|
WebBrowser |
Fallback to default application for x-scheme-handler/http MIME type |
Mixer |
|
Player |
|
Recorder |
|
FileManager |
Fallback to default application for inode/directory MIME type |
TerminalEmulator |
Used to open terminal-only applications (Terminal=true in .desktop file). See below |
Calculator |
|
TextEditor |
Fallback to default application for text/* |
When launching a terminal application, such as when Terminal=true
is specified in a desktop entry, the desktop should attempt to use the TerminalEmulator
intent, if supplied. In this case, the command to start the application is appended as multiple arguments to the value of the Exec
key of the TerminalEmulator
intent to create the full command. In addition, if the TerminalLaunchArgs
key is present in the desktop entry for the TerminalEmulator
, then it includes additional command line arguments that are included between the Exec
key of the TerminalEmulator
and the command to launch the application. For example, for xterm
, this would be -e
.