1XDG-MIME(1)                     xdg-mime Manual                    XDG-MIME(1)
2
3
4

NAME

6       xdg-mime - command line tool for querying information about file type
7       handling and adding descriptions for new file types
8

SYNOPSIS

10       xdg-mime query {filetype | default} ...
11
12       xdg-mime default application mimetype(s)
13
14       xdg-mime install [--mode mode] [--novendor] mimetypes-file
15
16       xdg-mime uninstall [--mode mode] mimetypes-file
17
18       xdg-mime {--help | --manual | --version}
19

DESCRIPTION

21       The xdg-mime program can be used to query information about file types
22       and to add descriptions for new file types.
23

COMMANDS

25       query
26           Returns information related to file types.
27
28           The query option is for use inside a desktop session only. It is
29           not recommended to use xdg-mime query as root.
30
31           The following queries are supported:
32
33           query filetype FILE: Returns the file type of FILE in the form of a
34           MIME type.
35
36           query default mimetype: Returns the default application that the
37           desktop environment uses for opening files of type mimetype. The
38           default application is identified by its *.desktop file.
39
40       default
41           Ask the desktop environment to make application the default
42           application for opening files of type mimetype. An application can
43           be made the default for several file types by specifying multiple
44           mimetypes.
45
46           application is the desktop file id of the application and has the
47           form vendor-name.desktop application must already be installed in
48           the desktop menu before it can be made the default handler. The
49           application's desktop file must list support for all the MIME types
50           that it wishes to be the default handler for.
51
52           Requests to make an application a default handler may be subject to
53           system policy or approval by the end-user. xdg-mime query can be
54           used to verify whether an application is the actual default handler
55           for a specific file type.
56
57           The default option is for use inside a desktop session only. It is
58           not recommended to use xdg-mime default as root.
59
60       install
61           Adds the file type descriptions provided in mimetypes-file to the
62           desktop environment.  mimetypes-file must be a XML file that
63           follows the freedesktop.org Shared MIME-info Database specification
64           and that has a mime-info element as its document root. For each new
65           file type one or more icons with name type-subtype must be
66           installed with the xdg-icon-resource command in the mimetypes
67           context. For example the filetype
68           application/vnd.oasis.opendocument.text requires an icon named
69           application-vnd.oasis.opendocument.text to be installed (unless the
70           file type recommends another icon name).
71
72       uninstall
73           Removes the file type descriptions provided in mimetypes-file and
74           previously added with xdg-mime install from the desktop
75           environment.  mimetypes-file must be a XML file that follows the
76           freedesktop.org Shared MIME-info Database specification and that
77           has a mime-info element as its document root.
78

OPTIONS

80       --mode mode
81           mode can be user or system. In user mode the file is (un)installed
82           for the current user only. In system mode the file is (un)installed
83           for all users on the system. Usually only root is allowed to
84           install in system mode.
85
86           The default is to use system mode when called by root and to use
87           user mode when called by a non-root user.
88
89       --novendor
90           Normally, xdg-mime checks to ensure that the mimetypes-file to be
91           installed has a proper vendor prefix. This option can be used to
92           disable that check.
93
94           A vendor prefix consists of alpha characters ([a-zA-Z]) and is
95           terminated with a dash ("-"). Companies and organizations are
96           encouraged to use a word or phrase, preferably the organizations
97           name, for which they hold a trademark as their vendor prefix. The
98           purpose of the vendor prefix is to prevent name conflicts.
99
100       --help
101           Show command synopsis.
102
103       --manual
104           Show this manual page.
105
106       --version
107           Show the xdg-utils version information.
108

ENVIRONMENT VARIABLES

110       xdg-mime honours the following environment variables:
111
112       XDG_UTILS_DEBUG_LEVEL
113           Setting this environment variable to a non-zero numerical value
114           makes xdg-mime do more verbose reporting on stderr. Setting a
115           higher value increases the verbosity.
116
117       XDG_UTILS_INSTALL_MODE
118           This environment variable can be used by the user or administrator
119           to override the installation mode. Valid values are user and
120           system.
121

EXIT CODES

123       An exit code of 0 indicates success while a non-zero exit code
124       indicates failure. The following failure codes can be returned:
125
126       1
127           Error in command line syntax.
128
129       2
130           One of the files passed on the command line did not exist.
131
132       3
133           A required tool could not be found.
134
135       4
136           The action failed.
137
138       5
139           No permission to read one of the files passed on the command line.
140

SEE ALSO

142       xdg-icon-resource(1), xdg-desktop-menu(1)
143

EXAMPLES

145           xdg-mime query filetype /tmp/foobar.png
146
147       Prints the MIME type of the file /tmp/foobar.png, in this case
148       image/png
149
150           xdg-mime query default image/png
151
152       Prints the .desktop filename of the application which is registered to
153       open PNG files.
154
155           xdg-mime install shinythings-shiny.xml
156
157       Adds a file type description for "shiny"-files. "shinythings-" is used
158       as the vendor prefix. The file type description could look as follows.
159
160           shinythings-shiny.xml:
161
162           <?xml version="1.0"?>
163           <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
164             <mime-type type="text/x-shiny">
165               <comment>Shiny new file type</comment>
166               <glob pattern="*.shiny"/>
167               <glob pattern="*.shi"/>
168             </mime-type>
169           </mime-info>
170
171       An icon for this new file type must also be installed, for example
172       with:
173
174           xdg-icon-resource install --context mimetypes --size 64 shiny-file-icon.png text-x-shiny
175
176

AUTHORS

178       Kevin Krammer
179           Author.
180
181       Jeremy White
182           Author.
183
185       Copyright © 2006
186
187
188
189xdg-utils 1.0                     11/05/2016                       XDG-MIME(1)
Impressum