Translation(s): English - Español - Italiano - Svenska

(!) ?Discussion


Default programs to be started

This page helps you to set default programs which open with various actions performed with your desktop, or even from command-line, or anything meant to be a default that can be changed.

The purpose of these settings is wide since this can affect applications started during the boot process, or just the ones which run when you perform a click on your file browser.

Debian Reference Manual : Customizing program to be started

Environment Variables

Environment variables mostly affect programs running in terminals and may have highest priority if a tool respect them. Well known examples are PAGER, EDITOR (or VISUAL), and BROWSER.

Refer to: EnvironmentVariables, environ(7), and documentation of specific tools, e.g. "ENVIRONMENT" section in their man pages.

Boot loader

A boot loader is one of the links in the system boot between the BIOS (or UEFI) and the kernel. Even if there is a risk to change from one to another, it may be needed or desired.

Init system

The Init system is composed of a program that is the first kernel process (PID 1) and provides a mechanism to run others (some called services or daemon) establishing the default environment before any new user session.

Login shell

The login shell choice is related to the UserAccounts and is generally one among the list shells. chsh may be used to change it for the user. At system wide the default when creating new user accounts is determined by adduser.conf.

Display manager

A display manager is a graphical user interface (GUI) front-end for login information entry, which then often directs to an actual full-fledged GUI session.

GUI Applications

Most of GUI applications and command line tools like xdg-open(1) (may be configured as open) follows XDG specifications when they need to open an external link or a file. Desktop environments have dialogues to arrange associations of file types and preferred applications, for example System Settings (former Control Center) in KDE. Under the hood it is managed through the ~/.config/mimeapps.list file.

Sometimes it is necessary to configure MIME types and URI protocols to change a default application. In the case of DefaultWebBrowser it is HTML and XHTML files, http: and https: protocol schemes. Internally they are represented as text/html, application/xhtml+xml, x-scheme-handler/http, and x-scheme-handler/https.

From command line current associations may be get by the following commands from the xdg-utils package:

xdg-mime query default x-scheme-handler/mailto
xdg-settings get default-url-scheme-handler https
xdg-mime query default application/xhtml+xml

Actually xdg-settings(1) calls xdg-mime(1). In some cases tools specific to current desktop environment may give more precise results. In KDE the following command reports list of available handlers sorted by priority:

ktraderclient5 --mimetype x-scheme-handler/mailto --servicetype Application

MIME types and URI scheme associations may be adjusted from command line

xdg-settings set default-url-scheme-handler mailto thunderbird.desktop
xdg-mime default thunderbird.desktop x-scheme-handler/mailto
xdg-mime default firefox-esr.desktop text/html

Notice the difference of argument order. Unlike xdg-mime, xdg-settings may append values to the MimeType record inside .desktop files in ~/.local/share/applications.

Configuration files that set preferred application may be edited directly. User-specific one is ~/.config/mimeapps.list, system-wide may be placed to /etc/xdg/mimeapps.list. These locations may be overridden by the XDG_CONFIG_HOME and XDG_CONFIG_DIRS environment variables. See the specification for other paths like ~/.local/share/applications/mimeapps.list ($XDG_CONFIG_DIRS/applications/mimeapps.list) and files specific to particular desktop environments. Example of setting a default application:

[Default Applications]
x-scheme-handler/mailto=thunderbird.desktop;

When a .desktop file provided by some application misses supported MIME types or URI schemes, they may be added to the [Added Associations] section. For example, browsers does not declare support of PDF files in their .desktop files despite they have built-in viewers. When adding new associations, it is necessary to explicitly set default. It is possible to use lists of .desktop files after =. Separator is ; (semicolon), pay attention to add it to the end of the list.

[Added Associations]
application/pdf=firefox-esr.desktop;chromium.desktop;
[Default Applications]
application/pdf=org.gnome.Evince.desktop;

If some application should be avoided in "Open with" menus then add a similar line to the [Removed Associations] section. Assume somebody does not like opening HTML files in abiword:

[Removed Associations]
text/html=abiword.desktop

When a lightweight window manager is used without any desktop environment then xdg-open (open) may use a browser to open links with unknown URI protocols (x-scheme-handler/...).

In KDE there is an additional cache related to handler mapping, to see effect of file edits immediately you may need to run

kbuildsycoca5

Before mimeapps.list files have become a standard way to configure handlers, desktop environments provided defaults.list files. As of Debian 12 bookworm they are still used at least by XFCE and Mate (e.g. /etc/mate/defaults.list, /usr/share/xfce4/applications/defaults.list). The specification recommends to use files like kde-mimeapps.list for settings specific to desktop environments, however defaults.list might still be taken into account.

After upgrade remnants of earlier configuration files may exist, so it may be necessary to check all possible paths and prefixes for mimeapps.list described in the specification.

File type handlers for text tools (mailcap)

Applications and tools may call external applications by looking up for a specific MIME type in mailcap(5) database. It was designed to handle attachments by email user agents, but its scope is wider. Besides mailers like mutt(1), it is supported by some applications like GNU Emacs having GUI and a set of convenience tools. The run-mailcap(1) helper has a number of aliases for specific actions: view, see, edit, compose, print. It may be configured as the open command, see DebianAlternatives.

The format of mailcap entries allows to specify that some application are suitable for GUI sessions only. There is no way to specify URI scheme handlers.

Priorities of installed MIME type handlers may be may be adjusted system-wide or may be overridden for specific users. See mailcap(5) or RFC1524 for the format of /etc/mailcap and ~/.mailcap files. Debian allows to select priority by means of /etc/mailcap.order and ~/.mailcap.order files, see mailcap.order(5). After editing of any of these files, it is necessary to regenerate the mailcap file using the Debian-specific update-mime(8) tool. Another purpose of this tool is to add to the mailcap database handlers specified in the MimeType fields of XDG .desktop files. However a part of mailcap files may be provided by a user or a system administrator.

System wide

Debian Alternatives

Debian Alternatives is a convenient mechanism to replace hard written command names in some program calls. It does so by managing the symlinks behind the generic names of the commands.

You can see current settings with :

$ update-alternatives --get-selections

and change them by :

# update-alternatives --config <name_of_command>

Example :

# update-alternatives --config x-www-browser
Il existe 3 choix pour l'alternative x-www-browser (qui fournit /usr/bin/x-www-browser).

  Sélection   Chemin                Priorité  État
------------------------------------------------------------
* 0            /usr/bin/firefox-esr   70        mode automatique
  1            /usr/bin/chromium      40        mode manuel
  2            /usr/bin/firefox-esr   70        mode manuel
  3            /usr/bin/surf          30        mode manuel

Appuyez sur <Entrée> pour conserver la valeur par défaut[*] ou choisissez le numéro sélectionné :

sensible-utils

sensible-utils provides scripts for common use cases.

This package comes handy when writing scripts which are meant to start a browser, editor or a pager, since you don't have to hardwrite the name of the software, but rather rely on sensible utils to run the user's prefered software or what makes the most sense.

$ dpkg -L sensible-utils | grep /usr/bin/
/usr/bin/select-editor
/usr/bin/sensible-browser
/usr/bin/sensible-editor
/usr/bin/sensible-pager

XDG and MIME

XDG provides a set of utilities (xdg-utils...) and commands (xdg-open...) to work with files according to their file types.

This might be used by your applications (file manager such as midnight commander, or web browsers) when you set up actions according to file types.

dpkg-reconfigure

To be confirmed

In case several packages provide the same functionality, reconfiguring them will make the reconfigured package take precedence.

Example:

# dpkg-reconfigure <package>
dpkg-reconfigure gdm3

Application specific

Firefox

Firefox respects configuration for #GUI_Applications, however associations of MIME types and URI protocols with specific handlers may be overridden. Go into following menu : Preferences > Applications (or type about:preferences#applications in address bar). These settings are saved in the =handlers.json= file inside the profile directory.

See the Manage file types and download actions in Firefox Mozilla Support page for details.

rox-filer

${HOME}/.config/rox.sourceforge.net/MIME-types


CategoryDesktop | CategorySystemAdministration