blob: 276aed1863eadc6981b5e41ef465e049c352e826 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
.\" ** You probably do not want to edit this file directly **
.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1).
.\" Instead of manually editing it, you probably should edit the DocBook XML
.\" source for it and then use the DocBook XSL Stylesheets to regenerate it.
.TH "XDG\-MIME" "1" "07/13/2006" "This is release 0.5 of the xdg\-mime Manu" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.SH "NAME"
xdg\-mime \- command line tool for querying information about file type handling and adding descriptions for new file types
.SH "SYNOPSIS"
.HP 9
\fBxdg\-mime\fR query {filetype default} \fIFILE\fR
.HP 9
\fBxdg\-mime\fR default \fIapplication\fR \fImimetype(s)\fR
.HP 9
\fBxdg\-mime\fR install {\fB\-\-user\fR \fB\-\-system\fR} \fImimetypes\-file\fR
.HP 9
\fBxdg\-mime\fR uninstall {\fB\-\-user\fR \fB\-\-system\fR} \fImimetypes\-file\fR
.HP 9
\fBxdg\-mime\fR {\fB\-\-help\fR \fB\-\-manual\fR \fB\-\-version\fR}
.SH "DESCRIPTION"
.PP
The xdg\-mime program can be used to query information about file types and to add descriptions for new file types.
.SH "COMMANDS"
.TP
query
Returns information related to the file type of
\fIFILE\fR.
.sp
The
\fIquery\fR
option is for use inside a desktop session only. It is not recommended to use xdg\-mime query as root.
.sp
The following queries are supported:
.sp
\fIfiletype\fR: Returns the file type of
\fIFILE\fR
in the form of a MIME type.
.sp
\fIdefault\fR: Returns the default application that the desktop environment uses for opening
\fIFILE\fR. The default applications is identified by its *.desktop file.
.TP
default
Ask the desktop environment to make
\fIapplication\fR
the default application for opening files of type
\fImimetype\fR. An application can be made the default for several file types by specifying multiple mimetypes.
.sp
\fIapplication\fR
is the desktop file id of the application and has the form vendor\-name.desktop
\fIapplication\fR
must already be installed in the desktop menu before it can be made the default handler. The aplication's desktop file must list support for all the MIME types that it wishes to be the default handler for.
.sp
Requests to make an application a default handler may be subject to system policy or approval by the end\-user. xdg\-mime query can be used to verify whether an application is the actual default handler for a specific file type.
.sp
The
\fIdefault\fR
option is for use inside a desktop session only. It is not recommended to use xdg\-mime default as root.
.TP
install
Adds the file type descriptions provided in
\fImimetypes\-file\fR
to the desktop environment.
\fImimetypes\-file\fR
must be a XML file that follows the freedesktop.org Shared MIME\-info Database specification and that has a mime\-info element as its document root. For each new file type one or more icons with name
\fImajor\fR\-\fIminor\fR
must be installed with the
\fBxdg\-icon\-resource\fR
command in the
\fImimetypes\fR
context. For example the application/vnd.oasis.opendocument.text filetype requires an icon by the name of application\-vnd.oasis.opendocument.text to be installed.
.TP
uninstall
Removes the file type descriptions provided in
\fImimetypes\-file\fR
and previously added with
\fBxdg\-mime install\fR
from the desktop environment.
\fImimetypes\-file\fR
must be a XML file that follows the freedesktop.org Shared MIME\-info Database specification and that has a mime\-info element as its document root.
.SH "OPTIONS"
.TP
\fB\-\-user\fR
Adds or removes file type descriptions for the current user only.
.TP
\fB\-\-system\fR
Adds or removes file type descriptions for all users on the system. Usually only root is allowed to do this.
.TP
\fB\-\-help\fR
Show command synopsis.
.TP
\fB\-\-manual\fR
Show this manualpage.
.TP
\fB\-\-version\fR
Show the xdg\-utils version information.
.SH "EXIT CODES"
.PP
An exit code of 0 indicates success while a non\-zero exit code indicates failure. The following failure codes can be returned:
.TP
\fB1\fR
Error in command line syntax.
.TP
\fB2\fR
One of the files passed on the command line did not exist.
.TP
\fB3\fR
A required tool could not be found.
.TP
\fB4\fR
The action failed.
.SH "SEE ALSO"
.PP
\fBxdg\-icon\-resource\fR(1),
\fBxdg\-desktop\-menu\fR(1)
.SH "EXAMPLES"
.PP
.nf
xdg\-mime query filetype /tmp/foobar.png
.fi
.sp
Prints the MIME type of the file /tmp/foobar.png
.PP
.nf
xdg\-mime query default /tmp/foobar.png
.fi
.sp
Prints the name of the .desktop file of the application which is registered to open files of the MIME type the file /tmp/foobar.png has
.PP
.nf
xdg\-mime install \-\-system diff.xml
.fi
.sp
Adds a file type description for "diff"\-files for all users on the system. The file type description could look as folows.
.sp
.nf
diff.xml:
<?xml version="1.0"?>
<mime\-info xmlns='http://www.freedesktop.org/standards/shared\-mime\-info'>
<mime\-type type="text/x\-diff">
<comment>Differences between files</comment>
<glob pattern="*.diff"/>
<glob pattern="*.patch"/>
</mime\-type>
</mime\-info>
.fi
.sp
An icon for this new file type must alsobe installed, for example with:
.sp
.nf
xdg\-icon\-resource install \-\-system \-\-context mimetypes \-\-size 64 text\-x\-diff.png
.fi
.sp
.SH "AUTHOR"
Kevin Krammer, Jeremy White.
.br
<kevin.krammer@gmx.at>
.br
<jwhite@codeweavers.com>
|