{{Note|The above replacements can be symbolically linked to ''xdg-open'' above {{ic|/usr/bin}} in the user's {{ic|$PATH}} (for example, {{ic|ln -s /usr/bin/sx-open /usr/local/bin/xdg-open}}). However, applications may hard-code the absolute path {{ic|/usr/bin/xdg-open}}. In this case, install {{AUR|xdg-utils-no-open}} from the [[AUR]] and copy the replacement to {{ic|/usr/bin/xdg-open}}.}}

+

{{Note|Some of the above packages replace {{ic|xdg-utils}}. Those that do not can be symbolically linked to ''xdg-open'' in the user's {{ic|$PATH}} above {{ic|/usr/bin}}, but some applications hard-code the absolute path {{ic|/usr/bin/xdg-open}}. In this case, install {{AUR|xdg-utils-no-open}} from the [[AUR]] and copy the replacement to {{ic|/usr/bin/xdg-open}}.}}

Revision as of 01:32, 20 February 2015

xdg-open is a desktop-independent tool for configuring the default applications of a user. Many applications invoke the xdg-open command internally.

Inside a desktop environment (e.g. GNOME, KDE, or Xfce), xdg-open simply passes the arguments to that desktop environment's file-opener application (gvfs-open, kde-open, or exo-open, respectively), which means that the associations are left up to the desktop environment. When no desktop environment is detected (for example when one runs a standalone window manager, e.g. Openbox), xdg-open will use its own configuration files.

Note: Some of the above packages replace xdg-utils. Those that do not can be symbolically linked to xdg-open in the user's $PATH above /usr/bin, but some applications hard-code the absolute path /usr/bin/xdg-open. In this case, install xdg-utils-no-openAUR from the AUR and copy the replacement to /usr/bin/xdg-open.

mailcap

This article or section needs expansion.

Reason: When using run-mailcapAUR, xdg-open may refer to it.[1] It should then clearly not be combined with the below file to prevent endless loops. (Discuss in Talk:Xdg-open#)

The .mailcap file format is used by mail programs such as mutt and sylpheed. To have those programs use xdg-open, edit ~/.mailcap:

~/.mailcap

*/*; xdg-open "%s

mimetype

mimetype in perl-file-mimeinfo package can display some mimetype-related information about a file.

For example:

$ mimetype file.ext

returns the mimetype of a file,

$ mimetype -d file.extension

returns a description of that mimetype.

When xdg-open fails to detect one of the desktop environments it knows about, it normally falls back to using file -i, which uses only file contents to determine the mimetype, resulting in some file types not being detected correctly. With mimetype available, xdg-open will use that instead, with better detection results, as mimetype uses the information in the shared mime info database.

Environment variables

Some environment variables, such as BROWSER, DE, and DESKTOP_SESSION, will change the behaviour of the default xdg-open. See Environment variables for more information.