Difference between revisions of "Default applications"

From ArchWiki
Jump to: navigation, search
(Maintaining settings for multiple desktop environments: Add info about OnlyShowIn)
m
Line 1: Line 1:
 
[[Category:Desktop environments (English)]]
 
[[Category:Desktop environments (English)]]
 
{{i18n|Default Applications}}
 
{{i18n|Default Applications}}
{{Stub}}
+
{{Expansion}}
 +
 
 
There are numerous places to configure default applications on Linux. This page will attempt to address problems related to the following issues:
 
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 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
 
* 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 ===
==Changing a default application ==
+
===xdg-open===
+
 
[[xdg-open]] is a desktop-independent tool for configuring default applications.
 
[[xdg-open]] is a desktop-independent tool for configuring default applications.
  
===Gnome 3===
+
==== Exactly how the config files mesh together ====
 +
This is not necessary reading, but here is, as nearly as I can tell, xdg-open looks for the following sections in the following files.
 +
~/.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 {{Ic|~/.local/}} file, then all of the {{Ic|/usr/}} files will be ignored for that MIME type.
 +
 
 +
See also [http://www.freedesktop.org/wiki/Specifications/mime-actions-spec this page on freedesktop.org], "Default application ordering" section.
 +
 
 +
=== Gnome 3 ===
 
The xdg-open settings are usually recognized by Gnome, but if they aren't, there are still other methods.
 
The xdg-open settings are usually recognized by Gnome, but if they aren't, there are still other methods.
  
====GConf====
+
==== 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 {{Codeline|gconf-editor}}; in particular, you can try messing with the {{filename|/desktop/gnome/applications/}} key, but changing settings there didn't fix any problems I had. dconf can be configured with the {{Codeline|gsettings}} command.
+
As far as I can tell, on Gnome 3, there are two configuration systems, GConf (older) and dconf (newer). GConf can be configured with {{Ic|gconf-editor}}; in particular, you can try messing with the {{filename|/desktop/gnome/applications/}} key, but changing settings there didn't fix any problems I had. dconf can be configured with the {{Ic|gsettings}} command.
  
====Terminal====
+
==== Terminal ====
 
To configure the default terminal for the package ''nautilus-open-terminal'' to Konsole, use
 
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 konsole
 
  $ gsettings set org.gnome.desktop.default-applications.terminal exec-arg "'-e'"
 
  $ gsettings set org.gnome.desktop.default-applications.terminal exec-arg "'-e'"
The second command tells {{Codeline|konsole}} to expect a command to be passed to it as part of the invocation. ''nautilus-open-terminal'' needs this because it passes a {{Codeline|cd}} command in order to switch to the appropriate directory. For example, opening a terminal in your {{filename|~/Desktop}} directory will invoke something like
+
The second command tells {{Ic|konsole}} to expect a command to be passed to it as part of the invocation. ''nautilus-open-terminal'' needs this because it passes a {{Ic|cd}} command in order to switch to the appropriate directory. For example, opening a terminal in your {{Ic|~/Desktop}} directory will invoke something like
 
  $ konsole -e cd "~/Desktop"
 
  $ konsole -e cd "~/Desktop"
====Web browser====
+
 
 +
==== Web browser ====
 
To configure the web browser used by the AUR package ''gnome-gmail-notifier'', run
 
To configure the web browser used by the AUR package ''gnome-gmail-notifier'', run
 
  $ gconf-editor
 
  $ gconf-editor
 
and edit the {{filename|/desktop/gnome/url-handlers/http/}} key. You may want to change {{filename|https/}}, {{filename|about/}}, and {{filename|unknown/}} keys while you're at it.
 
and edit the {{filename|/desktop/gnome/url-handlers/http/}} key. You may want to change {{filename|https/}}, {{filename|about/}}, and {{filename|unknown/}} keys while you're at it.
  
====Exactly how the config files mesh together====
+
== Maintaining settings for multiple desktop environments ==
This is not necessary reading, but here is, as nearly as I can tell, xdg-open looks for the following sections in the following files.
+
~/.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 {{filename|~/.local/}} file, then all of the {{filename|/usr/}} files will be ignored for that MIME type.
+
 
+
See also [http://www.freedesktop.org/wiki/Specifications/mime-actions-spec this page on freedesktop.org], "Default application ordering" section.
+
 
+
==Maintaining settings for multiple desktop environments==
+
 
The {{ic|OnlyShowIn}} field of a .desktop file may be useful; see [http://standards.freedesktop.org/menu-spec/latest/ this page]. I haven't tried setting this field yet; please update this wiki page if you have any info about using {{ic|OnlyShowIn}}.
 
The {{ic|OnlyShowIn}} field of a .desktop file may be useful; see [http://standards.freedesktop.org/menu-spec/latest/ this page]. I haven't tried setting this field yet; please update this wiki page if you have any info about using {{ic|OnlyShowIn}}.
  
==Troubleshooting==
+
== Troubleshooting ==
===Applications don't appear in the ''Open With...'' context menu (of a file manager)===
+
=== Applications don't appear in the ''Open With...'' context menu (of a file manager) ===
Sometimes, a certain application will not appear in the right-click ''Open With...'' dialog. To fix this problem, locate the {{filename|.desktop}} file in {{filename|/usr/share/applications}}, edit it as root, and add {{Codeline|%U}} to the end of the {{Codeline|1=<nowiki>Exec=</nowiki>}} line. For example, Kile currently has this problem; you need to edit {{filename|/usr/share/applications/kde4/kile.desktop}} and change the line reading {{Codeline|1=<nowiki>Exec=kile</nowiki>}} to read {{Codeline|1=<nowiki>Exec=kile %U</nowiki>}}. Also, please file a bug against the upstream project if you notice this problem.
+
Sometimes, a certain application will not appear in the right-click ''Open With...'' dialog. To fix this problem, locate the {{Ic|.desktop}} file in {{Ic|/usr/share/applications}}, edit it as root, and add {{Ic|%U}} to the end of the {{Ic|1=<nowiki>Exec=</nowiki>}} line. For example, Kile currently has this problem; you need to edit {{Ic|/usr/share/applications/kde4/kile.desktop}} and change the line reading {{Ic|1=<nowiki>Exec=kile</nowiki>}} to read {{Ic|1=<nowiki>Exec=kile %U</nowiki>}}. Also, please file a bug against the upstream project if you notice this problem.
  
You may also have to edit the {{Codeline|MimeTypes}} list in the {{filename|.desktop}} file if you install extensions that allow an application to handle additional MIME types.
+
You may also have to edit the {{Ic|MimeTypes}} list in the {{Ic|.desktop}} file if you install extensions that allow an application to handle additional MIME types.

Revision as of 04:57, 23 January 2012

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: please use the first argument of the template to provide a brief explanation. (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

Changing a default application

xdg-open

xdg-open is a desktop-independent tool for configuring default applications.

Exactly how the config files mesh together

This is not necessary reading, but here is, as nearly as I can tell, xdg-open looks for the following sections in the following files.

~/.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 ~/.local/ file, then all of the /usr/ files will be ignored for that MIME type.

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

Gnome 3

The xdg-open settings are usually recognized by Gnome, but if they aren't, there are still other methods.

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 gconf-editor; 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 gsettings 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 konsole to expect a command to be passed to it as part of the invocation. nautilus-open-terminal needs this because it passes a cd command in order to switch to the appropriate directory. For example, opening a terminal in your ~/Desktop 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.

Maintaining settings for multiple desktop environments

The OnlyShowIn field of a .desktop file may be useful; see this page. I haven't tried setting this field yet; please update this wiki page if you have any info about using OnlyShowIn.

Troubleshooting

Applications don't appear in the Open With... context menu (of a file manager)

Sometimes, a certain application will not appear in the right-click Open With... dialog. To fix this problem, locate the .desktop file in /usr/share/applications, edit it as root, and add %U to the end of the Exec= line. For example, Kile currently has this problem; you need to edit /usr/share/applications/kde4/kile.desktop and change the line reading Exec=kile to read Exec=kile %U. Also, please file a bug against the upstream project if you notice this problem.

You may also have to edit the MimeTypes list in the .desktop file if you install extensions that allow an application to handle additional MIME types.