OLD | NEW |
(Empty) | |
| 1 <?xml version="1.0"?> |
| 2 <?xml-stylesheet type="text/xsl" |
| 3 href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
"?> |
| 4 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" |
| 5 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ |
| 6 ]> |
| 7 <refentry id="xdg-mime"> |
| 8 <refentryinfo> |
| 9 <title>xdg-mime Manual</title> |
| 10 <copyright> |
| 11 <year>2006</year> |
| 12 </copyright> |
| 13 <author> |
| 14 <firstname>Kevin</firstname> |
| 15 <surname>Krammer</surname> |
| 16 </author> |
| 17 <address><email>kevin.krammer@gmx.at</email></address> |
| 18 <author> |
| 19 <firstname>Jeremy</firstname> |
| 20 <surname>White</surname> |
| 21 </author> |
| 22 <address><email>jwhite@codeweavers.com</email></address> |
| 23 <releaseinfo>xdg-utils 1.0</releaseinfo> |
| 24 </refentryinfo> |
| 25 |
| 26 <refmeta> |
| 27 <refentrytitle>xdg-mime</refentrytitle> |
| 28 <manvolnum>1</manvolnum> |
| 29 </refmeta> |
| 30 |
| 31 <refnamediv> |
| 32 <refname>xdg-mime</refname> |
| 33 <refpurpose>command line tool for querying information about file type handl
ing |
| 34 and adding descriptions for new file types</refpurpose> |
| 35 </refnamediv> |
| 36 |
| 37 <refsynopsisdiv> |
| 38 <cmdsynopsis> |
| 39 <command>xdg-mime</command> |
| 40 <arg choice="plain">query</arg> |
| 41 <group choice="req"> |
| 42 <arg choice="plain">filetype</arg> |
| 43 <arg choice="plain">default</arg> |
| 44 </group> |
| 45 <arg choice="plain">...</arg> |
| 46 </cmdsynopsis> |
| 47 <cmdsynopsis> |
| 48 <command>xdg-mime</command> |
| 49 <arg choice="plain">default</arg> |
| 50 <arg choice="plain"><replaceable>application</replaceable></arg> |
| 51 <arg choice="plain"><replaceable>mimetype(s)</replaceable></arg> |
| 52 </cmdsynopsis> |
| 53 <cmdsynopsis> |
| 54 <command>xdg-mime</command> |
| 55 <arg choice="plain">install</arg> |
| 56 <arg><option>--mode <replaceable>mode</replaceable></option></arg> |
| 57 <arg><option>--novendor</option></arg> |
| 58 <arg choice="plain"><replaceable>mimetypes-file</replaceable></arg> |
| 59 </cmdsynopsis> |
| 60 <cmdsynopsis> |
| 61 <command>xdg-mime</command> |
| 62 <arg choice="plain">uninstall</arg> |
| 63 <arg><option>--mode <replaceable>mode</replaceable></option></arg> |
| 64 <arg choice="plain"><replaceable>mimetypes-file</replaceable></arg> |
| 65 </cmdsynopsis> |
| 66 <cmdsynopsis> |
| 67 <command>xdg-mime</command> |
| 68 <group choice="req"> |
| 69 <arg choice="plain"><option>--help</option></arg> |
| 70 <arg choice="plain"><option>--manual</option></arg> |
| 71 <arg choice="plain"><option>--version</option></arg> |
| 72 </group> |
| 73 </cmdsynopsis> |
| 74 </refsynopsisdiv> |
| 75 |
| 76 <refsect1 id="description"> |
| 77 <title>Description</title> |
| 78 <para> |
| 79 The xdg-mime program can be used to query information about file types |
| 80 and to add descriptions for new file types. |
| 81 </para> |
| 82 </refsect1> |
| 83 <refsect1 id="commands"> |
| 84 <title>Commands</title> |
| 85 <variablelist> |
| 86 <varlistentry> |
| 87 <term>query</term> |
| 88 <listitem> |
| 89 <simpara> |
| 90 Returns information related to file types. |
| 91 </simpara> |
| 92 <simpara> |
| 93 The <emphasis>query</emphasis> option is for use inside a desktop se
ssion only. |
| 94 It is not recommended to use xdg-mime query as root. |
| 95 </simpara> |
| 96 <simpara> |
| 97 The following queries are supported: |
| 98 </simpara> |
| 99 <simpara>query filetype <replaceable>FILE</replaceable>: |
| 100 Returns the file type of <replaceable>FILE</replaceable> in the form
of a MIME type. |
| 101 </simpara> |
| 102 <simpara>query default <replaceable>mimetype</replaceable>: |
| 103 Returns the default application that the desktop environment uses fo
r opening |
| 104 files of type <replaceable>mimetype</replaceable>. The default appli
cation is |
| 105 identified by its *.desktop file. |
| 106 </simpara> |
| 107 </listitem> |
| 108 </varlistentry> |
| 109 |
| 110 <varlistentry> |
| 111 <term>default</term> |
| 112 <listitem> |
| 113 <simpara> |
| 114 Ask the desktop environment to make <replaceable>application</replac
eable> |
| 115 the default application for opening |
| 116 files of type <replaceable>mimetype</replaceable>. An |
| 117 application can be made the default for several file types by |
| 118 specifying multiple mimetypes. |
| 119 </simpara> |
| 120 <simpara> |
| 121 <replaceable>application</replaceable> is the desktop file |
| 122 id of the application and has the form vendor-name.desktop |
| 123 <replaceable>application</replaceable> must already be installed |
| 124 in the desktop menu before it can be made the default handler. |
| 125 The aplication's desktop file must list support for all the |
| 126 MIME types that it wishes to be the default handler for. |
| 127 </simpara> |
| 128 <simpara> |
| 129 Requests to make an application a default handler may be |
| 130 subject to system policy or approval by the end-user. xdg-mime |
| 131 query can be used to verify whether an application is the |
| 132 actual default handler for a specific file type. |
| 133 </simpara> |
| 134 <simpara> |
| 135 The <emphasis>default</emphasis> option is for use inside a desktop
session only. |
| 136 It is not recommended to use xdg-mime default as root. |
| 137 </simpara> |
| 138 </listitem> |
| 139 </varlistentry> |
| 140 |
| 141 <varlistentry> |
| 142 <term>install</term> |
| 143 <listitem> |
| 144 <simpara> |
| 145 Adds the file type descriptions provided in <replaceable>mimetypes-f
ile</replaceable> |
| 146 to the desktop environment. <replaceable>mimetypes-file</replaceable
> |
| 147 must be a XML file that follows the freedesktop.org |
| 148 Shared MIME-info Database specification |
| 149 and that has a mime-info element as its document root. For |
| 150 each new file type one or more icons with name |
| 151 <replaceable>major</replaceable>-<replaceable>minor</replaceable> |
| 152 must be installed with the <command>xdg-icon-resource</command> |
| 153 command in the <emphasis>mimetypes</emphasis> context. For example t
he |
| 154 application/vnd.oasis.opendocument.text filetype requires an |
| 155 icon by the name of application-vnd.oasis.opendocument.text |
| 156 to be installed. |
| 157 </simpara> |
| 158 </listitem> |
| 159 </varlistentry> |
| 160 |
| 161 <varlistentry> |
| 162 <term>uninstall</term> |
| 163 <listitem> |
| 164 <simpara> |
| 165 Removes the file type descriptions provided in <replaceable>mimetype
s-file</replaceable> |
| 166 and previously added with <command>xdg-mime install</command> from t
he |
| 167 desktop environment. <replaceable>mimetypes-file</replaceable> |
| 168 must be a XML file that follows the freedesktop.org |
| 169 Shared MIME-info Database specification |
| 170 and that has a mime-info element as its document root. |
| 171 </simpara> |
| 172 </listitem> |
| 173 </varlistentry> |
| 174 </variablelist> |
| 175 </refsect1> |
| 176 |
| 177 <refsect1 id="options"> |
| 178 <title>Options</title> |
| 179 <variablelist> |
| 180 <varlistentry> |
| 181 <term><option>--mode</option> <replaceable>mode</replaceable></term> |
| 182 <listitem> |
| 183 <simpara><replaceable>mode</replaceable> can be |
| 184 <emphasis>user</emphasis> or <emphasis>system</emphasis>. |
| 185 In user mode the file is (un)installed for the current user |
| 186 only. In system mode the file is (un)installed for all users |
| 187 on the system. Usually only root is allowed to install in |
| 188 system mode. |
| 189 </simpara> |
| 190 <simpara> |
| 191 The default is to use system mode when called by root |
| 192 and to use user mode when called by a non-root user. |
| 193 </simpara> |
| 194 </listitem> |
| 195 </varlistentry> |
| 196 <varlistentry> |
| 197 <term><option>--novendor</option></term> |
| 198 <listitem> |
| 199 <simpara> |
| 200 Normally, xdg-mime checks to ensure that the |
| 201 <replaceable>mimetypes-file</replaceable> to be installed |
| 202 has a proper vendor prefix. This option can be |
| 203 used to disable that check. |
| 204 </simpara> |
| 205 <simpara> |
| 206 A vendor prefix consists of alpha characters ([a-zA-Z]) and is |
| 207 terminated with a dash ("-"). |
| 208 Companies and organizations are encouraged to use a word |
| 209 or phrase, preferably the organizations name, for which they hold |
| 210 a trademark as their vendor prefix. |
| 211 The purpose of the vendor prefix is to prevent name conflicts. |
| 212 </simpara> |
| 213 </listitem> |
| 214 </varlistentry> |
| 215 |
| 216 <varlistentry> |
| 217 <term><option>--help</option></term> |
| 218 <listitem> |
| 219 <simpara> |
| 220 Show command synopsis. |
| 221 </simpara> |
| 222 </listitem> |
| 223 </varlistentry> |
| 224 |
| 225 <varlistentry> |
| 226 <term><option>--manual</option></term> |
| 227 <listitem> |
| 228 <simpara> |
| 229 Show this manualpage. |
| 230 </simpara> |
| 231 </listitem> |
| 232 </varlistentry> |
| 233 |
| 234 <varlistentry> |
| 235 <term><option>--version</option></term> |
| 236 <listitem> |
| 237 <simpara> |
| 238 Show the xdg-utils version information. |
| 239 </simpara> |
| 240 </listitem> |
| 241 </varlistentry> |
| 242 |
| 243 </variablelist> |
| 244 </refsect1> |
| 245 <refsect1 id="env_vars"> |
| 246 <title>Environment Variables</title> |
| 247 <para> |
| 248 xdg-mime honours the following environment variables: |
| 249 </para> |
| 250 <variablelist> |
| 251 <varlistentry> |
| 252 <term>XDG_UTILS_DEBUG_LEVEL</term> |
| 253 <listitem> |
| 254 <simpara> |
| 255 Setting this environment variable to a non-zero numerical value |
| 256 makes xdg-mime do more verbose reporting on stderr. |
| 257 Setting a higher value increases the verbosity. |
| 258 </simpara> |
| 259 </listitem> |
| 260 </varlistentry> |
| 261 <varlistentry> |
| 262 <term>XDG_UTILS_INSTALL_MODE</term> |
| 263 <listitem> |
| 264 <simpara> |
| 265 This environment variable can be used by the user or |
| 266 administrator to override the installation mode. |
| 267 Valid values are <emphasis>user</emphasis> and |
| 268 <emphasis>system</emphasis>. |
| 269 </simpara> |
| 270 </listitem> |
| 271 </varlistentry> |
| 272 </variablelist> |
| 273 </refsect1> |
| 274 |
| 275 <refsect1 id="exitcodes"> |
| 276 <title>Exit Codes</title> |
| 277 <para> |
| 278 An exit code of 0 indicates success while a non-zero exit code |
| 279 indicates failure. The following failure codes can be returned: |
| 280 </para> |
| 281 <variablelist> |
| 282 <varlistentry> |
| 283 <term><option>1</option></term> |
| 284 <listitem> |
| 285 <simpara> |
| 286 Error in command line syntax. |
| 287 </simpara> |
| 288 </listitem> |
| 289 </varlistentry> |
| 290 <varlistentry> |
| 291 <term><option>2</option></term> |
| 292 <listitem> |
| 293 <simpara> |
| 294 One of the files passed on the command line did not exist. |
| 295 </simpara> |
| 296 </listitem> |
| 297 </varlistentry> |
| 298 <varlistentry> |
| 299 <term><option>3</option></term> |
| 300 <listitem> |
| 301 <simpara> |
| 302 A required tool could not be found. |
| 303 </simpara> |
| 304 </listitem> |
| 305 </varlistentry> |
| 306 <varlistentry> |
| 307 <term><option>4</option></term> |
| 308 <listitem> |
| 309 <simpara> |
| 310 The action failed. |
| 311 </simpara> |
| 312 </listitem> |
| 313 </varlistentry> |
| 314 <varlistentry> |
| 315 <term><option>5</option></term> |
| 316 <listitem> |
| 317 <simpara> |
| 318 No permission to read one of the files passed on the command |
| 319 line. |
| 320 </simpara> |
| 321 </listitem> |
| 322 </varlistentry> |
| 323 </variablelist> |
| 324 </refsect1> |
| 325 <refsect1 id="seealso"> |
| 326 <title>See Also</title> |
| 327 <para><citerefentry><refentrytitle>xdg-icon-resource</refentrytitle> |
| 328 <manvolnum>1</manvolnum> |
| 329 </citerefentry>, |
| 330 <citerefentry><refentrytitle>xdg-desktop-menu</refentrytitle> |
| 331 <manvolnum>1</manvolnum> |
| 332 </citerefentry> |
| 333 </para> |
| 334 </refsect1> |
| 335 <refsect1 id="examples"> |
| 336 <title>Examples</title> |
| 337 <para> |
| 338 <programlisting> |
| 339 xdg-mime query filetype /tmp/foobar.png |
| 340 </programlisting>Prints the MIME type of the file /tmp/foobar.png, in this |
| 341 case image/png |
| 342 </para> |
| 343 <para> |
| 344 <programlisting> |
| 345 xdg-mime query default image/png |
| 346 </programlisting>Prints the .desktop filename of the application which is |
| 347 registered to open PNG files. |
| 348 </para> |
| 349 <para> |
| 350 <programlisting> |
| 351 xdg-mime install shinythings-shiny.xml |
| 352 </programlisting>Adds a file type description for "shiny"-files. |
| 353 "shinythings-" is used as the vendor prefix. |
| 354 The file type description could look as folows. |
| 355 <programlisting> |
| 356 shinythings-shiny.xml: |
| 357 |
| 358 <?xml version="1.0"?> |
| 359 <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> |
| 360 <mime-type type="text/x-shiny"> |
| 361 <comment>Shiny new file type</comment> |
| 362 <glob pattern="*.shiny"/> |
| 363 <glob pattern="*.shi"/> |
| 364 </mime-type> |
| 365 </mime-info> |
| 366 </programlisting>An icon for this new file type must also be installed, for |
| 367 example with: |
| 368 <programlisting> |
| 369 xdg-icon-resource install --context mimetypes --size 64 shiny-file-icon.png text
-x-shiny |
| 370 </programlisting> |
| 371 </para> |
| 372 </refsect1> |
| 373 </refentry> |
OLD | NEW |