OLD | NEW |
(Empty) | |
| 1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859
-1"><title>xdg-mime</title><meta name="generator" content="DocBook XSL Styleshee
ts V1.69.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840
084" alink="#0000FF"><div class="refentry" lang="en"><a name="xdg-mime"></a><div
class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>xdg-mime —
; command line tool for querying information about file type handling |
| 2 and adding descriptions for new file types</p></div><div class="refsynopsisdiv">
<h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">xdg-mime</cod
e> query { filetype | default } ... </p></div><div class="cmdsynopsis"><p
><code class="command">xdg-mime</code> default <em class="replaceable"><code
>application</code></em> <em class="replaceable"><code>mimetype(s)</code></em>
</p></div><div class="cmdsynopsis"><p><code class="command">xdg-mime</code> i
nstall [<code class="option">--mode <em class="replaceable"><code>mode</code></
em></code>] [<code class="option">--novendor</code>] <em class="replaceable"><c
ode>mimetypes-file</code></em> </p></div><div class="cmdsynopsis"><p><code class
="command">xdg-mime</code> uninstall [<code class="option">--mode <em class="
replaceable"><code>mode</code></em></code>] <em class="replaceable"><code>mimet
ypes-file</code></em> </p></div><div class="cmdsynopsis"><p><code class="command
">xdg-mime</code> { <code class="option">--help</code> | <code class="option
">--manual</code> | <code class="option">--version</code> }</p></div></div><d
iv class="refsect1" lang="en"><a name="description"></a><h2>Description</h2><p> |
| 3 The xdg-mime program can be used to query information about file types |
| 4 and to add descriptions for new file types. |
| 5 </p></div><div class="refsect1" lang="en"><a name="commands"></a><h2>Command
s</h2><div class="variablelist"><dl><dt><span class="term">query</span></dt><dd>
<p> |
| 6 Returns information related to file types. |
| 7 </p><p> |
| 8 The <span class="emphasis"><em>query</em></span> option is for use i
nside a desktop session only. |
| 9 It is not recommended to use xdg-mime query as root. |
| 10 </p><p> |
| 11 The following queries are supported: |
| 12 </p><p>query filetype <em class="replaceable"><code>FILE</code></em>: |
| 13 Returns the file type of <em class="replaceable"><code>FILE</code></
em> in the form of a MIME type. |
| 14 </p><p>query default <em class="replaceable"><code>mimetype</code></em
>: |
| 15 Returns the default application that the desktop environment uses fo
r opening |
| 16 files of type <em class="replaceable"><code>mimetype</code></em>. Th
e default application is |
| 17 identified by its *.desktop file. |
| 18 </p></dd><dt><span class="term">default</span></dt><dd><p> |
| 19 Ask the desktop environment to make <em class="replaceable"><code>ap
plication</code></em> |
| 20 the default application for opening |
| 21 files of type <em class="replaceable"><code>mimetype</code></em>. An |
| 22 application can be made the default for several file types by |
| 23 specifying multiple mimetypes. |
| 24 </p><p> |
| 25 <em class="replaceable"><code>application</code></em> is the desktop
file |
| 26 id of the application and has the form vendor-name.desktop |
| 27 <em class="replaceable"><code>application</code></em> must already b
e installed |
| 28 in the desktop menu before it can be made the default handler. |
| 29 The aplication's desktop file must list support for all the |
| 30 MIME types that it wishes to be the default handler for. |
| 31 </p><p> |
| 32 Requests to make an application a default handler may be |
| 33 subject to system policy or approval by the end-user. xdg-mime |
| 34 query can be used to verify whether an application is the |
| 35 actual default handler for a specific file type. |
| 36 </p><p> |
| 37 The <span class="emphasis"><em>default</em></span> option is for use
inside a desktop session only. |
| 38 It is not recommended to use xdg-mime default as root. |
| 39 </p></dd><dt><span class="term">install</span></dt><dd> |
| 40 Adds the file type descriptions provided in <em class="replaceable">
<code>mimetypes-file</code></em> |
| 41 to the desktop environment. <em class="replaceable"><code>mimetypes-
file</code></em> |
| 42 must be a XML file that follows the freedesktop.org |
| 43 Shared MIME-info Database specification |
| 44 and that has a mime-info element as its document root. For |
| 45 each new file type one or more icons with name |
| 46 <em class="replaceable"><code>major</code></em>-<em class="replaceab
le"><code>minor</code></em> |
| 47 must be installed with the <span><strong class="command">xdg-icon-re
source</strong></span> |
| 48 command in the <span class="emphasis"><em>mimetypes</em></span> cont
ext. For example the |
| 49 application/vnd.oasis.opendocument.text filetype requires an |
| 50 icon by the name of application-vnd.oasis.opendocument.text |
| 51 to be installed. |
| 52 </dd><dt><span class="term">uninstall</span></dt><dd> |
| 53 Removes the file type descriptions provided in <em class="replaceabl
e"><code>mimetypes-file</code></em> |
| 54 and previously added with <span><strong class="command">xdg-mime ins
tall</strong></span> from the |
| 55 desktop environment. <em class="replaceable"><code>mimetypes-file</c
ode></em> |
| 56 must be a XML file that follows the freedesktop.org |
| 57 Shared MIME-info Database specification |
| 58 and that has a mime-info element as its document root. |
| 59 </dd></dl></div></div><div class="refsect1" lang="en"><a name="options
"></a><h2>Options</h2><div class="variablelist"><dl><dt><span class="term"><code
class="option">--mode</code> <em class="replaceable"><code>mode</code></em></sp
an></dt><dd><p><em class="replaceable"><code>mode</code></em> can be |
| 60 <span class="emphasis"><em>user</em></span> or <span class="emphasis
"><em>system</em></span>. |
| 61 In user mode the file is (un)installed for the current user |
| 62 only. In system mode the file is (un)installed for all users |
| 63 on the system. Usually only root is allowed to install in |
| 64 system mode. |
| 65 </p><p> |
| 66 The default is to use system mode when called by root |
| 67 and to use user mode when called by a non-root user. |
| 68 </p></dd><dt><span class="term"><code class="option">--novendor</code>
</span></dt><dd><p> |
| 69 Normally, xdg-mime checks to ensure that the |
| 70 <em class="replaceable"><code>mimetypes-file</code></em> to be insta
lled |
| 71 has a proper vendor prefix. This option can be |
| 72 used to disable that check. |
| 73 </p><p> |
| 74 A vendor prefix consists of alpha characters ([a-zA-Z]) and is |
| 75 terminated with a dash ("-"). |
| 76 Companies and organizations are encouraged to use a word |
| 77 or phrase, preferably the organizations name, for which they hold |
| 78 a trademark as their vendor prefix. |
| 79 The purpose of the vendor prefix is to prevent name conflicts. |
| 80 </p></dd><dt><span class="term"><code class="option">--help</code></sp
an></dt><dd> |
| 81 Show command synopsis. |
| 82 </dd><dt><span class="term"><code class="option">--manual</code></span
></dt><dd> |
| 83 Show this manualpage. |
| 84 </dd><dt><span class="term"><code class="option">--version</code></spa
n></dt><dd> |
| 85 Show the xdg-utils version information. |
| 86 </dd></dl></div></div><div class="refsect1" lang="en"><a name="env_var
s"></a><h2>Environment Variables</h2><p> |
| 87 xdg-mime honours the following environment variables: |
| 88 </p><div class="variablelist"><dl><dt><span class="term">XDG_UTILS_DEBUG_LEV
EL</span></dt><dd> |
| 89 Setting this environment variable to a non-zero numerical value |
| 90 makes xdg-mime do more verbose reporting on stderr. |
| 91 Setting a higher value increases the verbosity. |
| 92 </dd><dt><span class="term">XDG_UTILS_INSTALL_MODE</span></dt><dd> |
| 93 This environment variable can be used by the user or |
| 94 administrator to override the installation mode. |
| 95 Valid values are <span class="emphasis"><em>user</em></span> and |
| 96 <span class="emphasis"><em>system</em></span>. |
| 97 </dd></dl></div></div><div class="refsect1" lang="en"><a name="exitcod
es"></a><h2>Exit Codes</h2><p> |
| 98 An exit code of 0 indicates success while a non-zero exit code |
| 99 indicates failure. The following failure codes can be returned: |
| 100 </p><div class="variablelist"><dl><dt><span class="term"><code class="option
">1</code></span></dt><dd> |
| 101 Error in command line syntax. |
| 102 </dd><dt><span class="term"><code class="option">2</code></span></dt><
dd> |
| 103 One of the files passed on the command line did not exist. |
| 104 </dd><dt><span class="term"><code class="option">3</code></span></dt><
dd> |
| 105 A required tool could not be found. |
| 106 </dd><dt><span class="term"><code class="option">4</code></span></dt><
dd> |
| 107 The action failed. |
| 108 </dd><dt><span class="term"><code class="option">5</code></span></dt><
dd> |
| 109 No permission to read one of the files passed on the command |
| 110 line. |
| 111 </dd></dl></div></div><div class="refsect1" lang="en"><a name="seealso
"></a><h2>See Also</h2><p><span class="citerefentry"><span class="refentrytitle"
>xdg-icon-resource</span>(1)</span>, |
| 112 <span class="citerefentry"><span class="refentrytitle">xdg-desktop-menu</s
pan>(1)</span> |
| 113 </p></div><div class="refsect1" lang="en"><a name="examples"></a><h2>Example
s</h2><p> |
| 114 </p><pre class="programlisting"> |
| 115 xdg-mime query filetype /tmp/foobar.png |
| 116 </pre><p>Prints the MIME type of the file /tmp/foobar.png, in this |
| 117 case image/png |
| 118 </p><p> |
| 119 </p><pre class="programlisting"> |
| 120 xdg-mime query default image/png |
| 121 </pre><p>Prints the .desktop filename of the application which is |
| 122 registered to open PNG files. |
| 123 </p><p> |
| 124 </p><pre class="programlisting"> |
| 125 xdg-mime install shinythings-shiny.xml |
| 126 </pre><p>Adds a file type description for "shiny"-files. |
| 127 "shinythings-" is used as the vendor prefix. |
| 128 The file type description could look as folows. |
| 129 </p><pre class="programlisting"> |
| 130 shinythings-shiny.xml: |
| 131 |
| 132 <?xml version="1.0"?> |
| 133 <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> |
| 134 <mime-type type="text/x-shiny"> |
| 135 <comment>Shiny new file type</comment> |
| 136 <glob pattern="*.shiny"/> |
| 137 <glob pattern="*.shi"/> |
| 138 </mime-type> |
| 139 </mime-info> |
| 140 </pre><p>An icon for this new file type must also be installed, for |
| 141 example with: |
| 142 </p><pre class="programlisting"> |
| 143 xdg-icon-resource install --context mimetypes --size 64 shiny-file-icon.png text
-x-shiny |
| 144 </pre><p> |
| 145 </p></div></div></body></html> |
OLD | NEW |