mime-types-application-user.page 4.04 KB
Newer Older
1 2 3 4 5 6 7 8
<page xmlns="http://projectmallard.org/1.0/"
      type="topic" style="task"
      id="mime-types-application-user">

  <info>
    <link type="guide" xref="software#management" />
    <link type="seealso" xref="mime-types-custom-user" />
    <link type="seealso" xref="mime-types-custom" />
9
    <revision pkgversion="3.30" date="2019-02-08" status="review"/>
10

11
    <credit type="author copyright">
12 13
      <name>Petr Kovar</name>
      <email>pknbe@volny.cz</email>
14
      <years>2014</years>
15 16 17 18
    </credit>

    <include href="legal.xml" xmlns="http://www.w3.org/2001/XInclude"/>

19 20
    <desc>Customize per user which application opens a specific MIME type.
    </desc>
21 22 23
  </info>

    <title>Override the default registered application for individual users</title>
24 25 26 27 28 29 30

    <p>
      The <file>/usr/share/applications/mimeapps.list</file> and
      <file>/usr/share/applications/gnome-mimeapps.list</file> files
      specify which application is registered to open specific MIME types by
      default. These files are provided by the distribution.
    </p>
31
    <p>
32 33 34
      To override the system defaults for individual users, you need to
      create a <file>~/.config/mimeapps.list</file> file with a list of MIME
      types for which you want to override the default registered application.
35 36 37 38 39
    </p>
    <steps>
      <title>Override the default registered application for individual users</title>
      <item>
        <p>
40
          Consult the <file>/usr/share/applications/mimeapps.list</file>
41 42
          file to determine the MIME types for which you want to change the
          default registered application. For example, the following sample of
43
          the <file>mimeapps.list</file> file specifies the default
44 45 46 47 48 49 50 51 52 53
          registered application for the <code>text/html</code> and
          <code>application/xhtml+xml</code> MIME types:
        </p>
        <code>[Default Applications]
text/html=epiphany.desktop
application/xhtml+xml=epiphany.desktop</code>
        <p>
          The default application (<app>Epiphany</app>) is defined
          by specifying its corresponding <file>.desktop</file> file
          (<file>epiphany.desktop</file>). The system default location
54 55
          for other applications’ <file>.desktop</file> files is
          <file>/usr/share/applications/</file>. Individual users’
56 57 58 59 60 61
          <file>.desktop</file> files can be stored in
          <file>~/.local/share/applications/</file>.
        </p>
      </item>
      <item>
        <p>
62 63 64
          Create the <file>~/.config/mimeapps.list</file> file. In the file,
          specify the MIME types and their corresponding default registered
          applications:
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
        </p>
        <code>[Default Applications]
text/html=<var>myapplication1.desktop</var>
application/xhtml+xml=<var>myapplication2.desktop</var>

[Added Associations]
text/html=<var>myapplication1.desktop</var>;
application/xhtml+xml=<var>myapplication2.desktop</var>;</code>
      <p>
        This sets the default registered application for the
        <code>text/html</code> MIME type to <code>myapplication1.desktop</code>,
        and the default registered application for the
        <code>application/xhtml+xml</code> MIME type to
        <code>myapplication2.desktop</code>.
      </p>
        <p>For these settings to function properly, ensure that both the
        <file>myapplication1.desktop</file> and
        <file>myapplication2.desktop</file> files are placed in the
83 84 85
        <file>/usr/share/applications/</file> directory. Individual users’
        <file>.desktop</file> files can be stored in
        <file>~/.local/share/applications/</file>.
86 87 88 89
      </p>
      </item>
      <item>
        <p>
90
          You can use the <cmd>gio mime</cmd> command to verify
91 92
          that the default registered application has been set correctly:
        </p>
93
        <screen><output>$ </output><input>gio mime text/html</input>
94
Default application for “text/html”: myapplication1.desktop
95 96 97 98 99 100 101 102 103 104
Registered applications:
	myapplication1.desktop
	epiphany.desktop
Recommended applications:
	myapplication1.desktop
	epiphany.desktop</screen>
      </item>
    </steps>
</page>