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

OPTIONS

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

ENVIRONMENT VARIABLES

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

EXIT CODES

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

SEE ALSO

136       xdg-icon-resource(1), xdg-desktop-menu(1)
137

EXAMPLES

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

AUTHOR

172       Kevin Krammer, Jeremy White.
173       <kevin.krammer@gmx.at>
174       <jwhite@codeweavers.com>
175
176
177
178xdg-utils 1.0                     06/24/2007                       XDG-MIME(1)
Impressum