Default applications

From ArchWiki
Jump to: navigation, search

There is frequently more than one application able to handle data of a certain type, so users and even some packages assemble lists of default applications for each #MIME type. While the base install of Arch Linux does not define default applications, desktop environments you install may do so. Some desktop environments also provide a GUI or a file-manager which can interactively configure default applications. If you do not use a desktop environment, you may need to install additional software in order to conveniently manage default applications.

The configuration of default applications depends on which launcher is used. Unfortunately there are multiple incompatible standards and many programs even have their own custom formats.

The most common standards are explained below for manual editing. There are also several #Utilities which can do the job, which may or may not implement the following standards.

MIME types

Before setting the default application per file type, the file type must be detected. There are two common ways that this detection is done:

  • using the file name extension e.g. .html or .jpeg
  • using a magic number in the first few bytes of the file

However it is possible that a single file type is identified by several different magic numbers and file name extensions, therefore MIME types are used to represent distinct file types. MIME types are specified by two parts separated by a slash: type/subtype. The type describes the general category of the content, while the subtype identifies the specific data type. For example, image/jpeg is the MIME type for JPEG images, while video/H264 is the MIME type for H.264 video.

Technically, every MIME type should be registered with the IANA[1], however many applications use unofficial MIME types; these often have a type starting with x-, for example x-scheme-handler/https for a HTTPS URL. For local use, the XDG MIME Applications#Shared MIME database can be used by other packages to register new MIME types.


Environment variables

Console programs in particular are configured by setting an appropriate environment variable, e.g. BROWSER or EDITOR. See Environment variables#Default programs.

XDG standard

See XDG MIME Applications.


Some applications use the UNIX-traditional mailcap and mime.types files. See RFC 1524 and mailcap(4) for the format documentation.

The mailcap package provides a /etc/mailcap that uses xdg-open(1) for the most common MIME types.

Warning: If you use run-mailcapAUR, it is possible for xdg-open to delegate to it. This will cause an infinite loop if you configured your mailcap as described above.