Default applications
This article lists methods of setting default applications in applications and Linux desktop environments.
Setting the default application via file manager
In many cases it suffices to use file manager's capability to set default applications for specific file types (e.g. via right-click context menu). Please refer to the specific file manager manual.
Setting the default application via desktop environment
Some desktop environments like GNOME or KDE allow you to set default application by their own means. With the other desktop environments, you can run xfce4-mime-settings from xfce-base/xfce4-settings.
Setting the default application via mimeapps.list files
MIME types describe the kind of content a file contains, which practically determines the applications to be used when opening or editing a file of a specific MIME type. While using a file manager or desktop environment to set default applications may work for the most basic cases (they change mimeapps.list files), the most thorough way to associate file types and applications is by manually editing the MIME configuration files and using dedicated tools.
$XDG_CONFIG_HOME/mimeapps.list (~/.config/mimeapps.list) is often used to update the associations between applications and mimetypes. The location of all mimeapps.list files and their precedence is specified in the Freedesktop standard.
~/.config/mimeapps.list
Set Qutebrowser as the default browserx-scheme-handler/http=org.qutebrowser.qutebrowser.desktop
x-scheme-handler/https=org.qutebrowser.qutebrowser.desktop
Setting the default application via xdg-settings
For example, if www-client/lynx is the default web-browser, but you'd like it to become chromium use:
user $
xdg-settings set default-web-browser chromium-browser-chromium.desktop
user $
xdg-settings set default-url-scheme-handler http chromium-browser-chromium.desktop
user $
xdg-settings set default-url-scheme-handler https chromium-browser-chromium.desktop
See /usr/share/applications/ for the list of applicable software on your system.
Looking up the default application of a specified MIME type
To find out the default application for directories use:
user $
xdg-mime query default inode/directory
Looking up MIME types associated with a specific application
To look up MIME types Inkscape is capable of working with use:
user $
grep MimeType /usr/share/applications/inkscape.desktop
Setting default MIME type for a specific application
A default application can be set to a MIME type with the xdg-mime by specifying the {application_name}.desktop file found in /usr/share/applications/{application_name}.desktop
For example to set the default application for a CSV file to Libre Office Calc:
user $
xdg-mime default libreoffice-calc.desktop text/csv
Confirm default is set with previously described syntax:
user $
xdg-mime query default text/csv
Pitfalls
Few applications do not honor the Freedesktop standard.