Default applications

From ArchWiki
Revision as of 16:48, 15 December 2011 by KerrickStaley (Talk | contribs) (I put the {{Poor Writing}} template in because I hoped someone would improve it, but nobody seemed interested. It's good enough.)

Jump to: navigation, search

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Default applications#)

There are numerous places to configure default applications on Linux. This page will attempt to address problems related to the following issues:

  • You need to change a certain default application (e.g. after switching desktop environments), but there appears to be nowhere to configure it, or an application ignores your configuration
  • You regularly switch back and forth between several desktop environments, and need to configure some applications (e.g. file manager) on a per-desktop-environment basis, but need to configure others (e.g. web browser) globally

Until there is more information/organization, it will just be a dumping ground of random tricks

Changing a default application

xdg-open

The Template:Codeline command uses the Template:Filename file to pick which application to use. Many applications invoke this command internally, so this may be the best place to look. Its contents refer to the Template:Filename files located in /usr/share/applications/. KDE applications are located in the Template:Filename subdirectory and are referred to by prefixing Template:Filename to the Template:Filename file's name (e.g. Template:Filename).

Template:Filename lists applications in order of preference; if the first listed application is not installed, the second one will be used. Its format is as follows:

...
[Default Applications]
mimetype=desktopfile1;desktopfile2...

For example,

[Default Applications]
text/html=firefox.desktop
inode/directory=kde4-dolphin.desktop;Thunar.desktop;nautilus.desktop

The best way to look up the MIME type is to read the Template:Codeline list in your application's Template:Filename file.

You shouldn't mess with the Template:Codeline section, but see Exactly how the config files mesh together if you do. There is also a Template:Filename that doesn't exist on Arch by default which you also probably shouldn't mess with.

You can put custom Template:Filename files into Template:Filename.

Gnome 3

xdg-open

The file Template:Filename has the same syntax as Template:Filename. You can use it instead of Template:Filename, but it's probably best to use Template:Filename; see Exactly how the config files mesh together.

Sometimes, a certain application will not appear in the right-click Open With... dialog. To fix this problem, locate the Template:Filename file in Template:Filename, edit it as root, and add Template:Codeline to the end of the Template:Codeline line. For example, Kile currently has this problem; you need to edit Template:Filename and change the line reading Template:Codeline to read Template:Codeline. Also, please file a bug against the upstream project if you notice this problem.

You may also have to edit the Template:Codeline list in the Template:Filename file if you install extensions that allow an application to handle additional MIME types.

GConf

As far as I can tell, on Gnome 3, there are two configuration systems, GConf (older) and dconf (newer). GConf can be configured with Template:Codeline; in particular, you can try messing with the Template:Filename key, but changing settings there didn't fix any problems I had. dconf can be configured with the Template:Codeline command.

Terminal

To configure the default terminal for the package nautilus-open-terminal to Konsole, use

$ gsettings set org.gnome.desktop.default-applications.terminal exec konsole
$ gsettings set org.gnome.desktop.default-applications.terminal exec-arg "'-e'"

The second command tells Template:Codeline to expect a command to be passed to it as part of the invocation. nautilus-open-terminal needs this because it passes a Template:Codeline command in order to switch to the appropriate directory. For example, opening a terminal in your Template:Filename directory will invoke something like

$ konsole -e cd "~/Desktop"

Web browser

To configure the web browser used by the AUR package gnome-gmail-notifier, run

$ gconf-editor

and edit the Template:Filename key. You may want to change Template:Filename, Template:Filename, and Template:Filename keys while you're at it.

Exactly how the config files mesh together

This is not necessary reading, but here is, as nearly as I can tell, the precedence order for the various config files, from high to low:

~/.local/share/applications/mimeapps.list, [Default Applications] section
~/.local/share/applications/mimeapps.list, [Added Applications] section
~/.local/share/applications/defaults.list
/usr/share/applications/mimeapps.list, [Default Applications] section
/usr/share/applications/mimeapps.list, [Added Applications] section
/usr/share/applications/defaults.list

Note that ordinarily, if a higher-precedence config file (or config file section) specifies an application that is not installed, it will fall-back to a lower-precedence config file (or section). However, if a non-existent application is specified in any Template:Filename file, then all of the Template:Filename files will be ignored for that MIME type.

See also this page on freedesktop.org, "Default application ordering" section.

Maintaining settings for multiple desktop environments

More info later...