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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
|
.\" ** 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\-DESKTOP\-MENU" "1" "06/24/2007" "xdg\-utils 1.0" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.SH "NAME"
xdg\-desktop\-menu \- command line tool for (un)installing desktop menu items
.SH "SYNOPSIS"
.HP 17
\fBxdg\-desktop\-menu\fR install [\fB\-\-noupdate\fR] [\fB\-\-novendor\fR] [\fB\-\-mode\ \fR\fB\fImode\fR\fR] \fIdirectory\-file(s)\fR \fIdesktop\-file(s)\fR
.HP 17
\fBxdg\-desktop\-menu\fR uninstall [\fB\-\-noupdate\fR] [\fB\-\-mode\ \fR\fB\fImode\fR\fR] \fIdirectory\-file(s)\fR \fIdesktop\-file(s)\fR
.HP 17
\fBxdg\-desktop\-menu\fR forceupdate [\fB\-\-mode\ \fR\fB\fImode\fR\fR]
.HP 17
\fBxdg\-desktop\-menu\fR {\fB\-\-help\fR \fB\-\-manual\fR \fB\-\-version\fR}
.SH "DESCRIPTION"
.PP
The xdg\-desktop\-menu program can be used to install new menu entries to the desktop's application menu.
.PP
The application menu works according to the XDG Desktop Menu Specification at http://www.freedesktop.org/Standards/menu\-spec
.SH "COMMANDS"
.TP
install
Install one or more applications in a submenu of the desktop menu system.
.sp
\fIdesktop\-file\fR: A desktop file represents a single menu entry in the menu. Desktop files are defined by the freedesktop.org Desktop Entry Specification. The most important aspects of *.desktop files are summarized below.
.sp
Menu entries can be added to the menu system in two different ways. They can either be added to a predefined submenu in the menu system based on one or more category keywords, or they can be added to a new submenu.
.sp
To add a menu entry to a predefined submenu the desktop file that represents the menu entry must have a Categories= entry that lists one or more keywords. The menu item will be included in an appropriate submenu based on the included keywords.
.sp
To add menu items to a new submenu the desktop\-files must be preceded by a directory\-file that describes the submenu. If multiple desktop\-files are specified, all entries will be added to the same menu. If entries are installed to a menu that has been created with a previous call to
\fBxdg\-desktop\-menu\fR
the entries will be installed in addition to any already existing entries.
.sp
\fIdirectory\-file\fR: The *.directory file indicated by
\fIdirectory\-file\fR
represents a submenu. The directory file provides the name and icon for a submenu. The name of the directory file is used to identify the submenu.
.sp
If multiple directory files are provided each file will represent a submenu within the menu that preceeds it, creating a nested menu hierarchy (sub\-sub\-menus). The menu entries themselves will be added to the last submenu.
.sp
Directory files follow the syntax defined by the freedesktop.org Desktop Entry Specification.
.TP
uninstall
Remove applications or submenus from the desktop menu system previously installed with
\fBxdg\-desktop\-menu install\fR.
.sp
A submenu and the associated directory file is only removed when the submenu no longer contains any menu entries.
.TP
forceupdate
Force an update of the menu system.
.sp
This command is only useful if the last call to xdg\-desktop\-menu included the
\fB\-\-noupdate\fR
option.
.SH "OPTIONS"
.TP
\fB\-\-noupdate\fR
Postpone updating the menu system. If multiple updates to the menu system are made in sequence this flag can be used to indicate that additional changes will follow and that it is not necassery to update the menu system right away.
.TP
\fB\-\-novendor\fR
Normally, xdg\-desktop\-menu checks to ensure that any *.directory and *.desktop files to be installed has a vendor prefix. This option can be used to disable that check.
.sp
A vendor prefix consists of alpha characters ([a\-zA\-Z]) and is terminated with a dash ("\-"). Companies and organizations are encouraged to use a word or phrase, preferably the organizations name, for which they hold a trademark as their vendor prefix. The purpose of the vendor prefix is to prevent name conflicts.
.TP
\fB\-\-mode\fR \fImode\fR
\fImode\fR
can be
\fIuser\fR
or
\fIsystem\fR. In user mode the file is (un)installed for the current user only. In system mode the file is (un)installed for all users on the system. Usually only root is allowed to install in system mode.
.sp
The default is to use system mode when called by root and to use user mode when called by a non\-root user.
.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 "DESKTOP FILES"
.PP
An application item in the application menu is represented by a *.desktop file. A *.desktop file consists of a
\fI[Desktop Entry]\fR
header followed by several
\fIKey\fR=\fIValue\fR
lines.
.PP
A *.desktop file can provide a name and description for an application in several different languages. This is done by adding a language code as used by LC_MESSAGES in square brackets behind the
\fIKey\fR. This way one can specify different values for the same
\fIKey\fR
depending on the currently selected language.
.PP
The following keys are often used:
.TP
Value=1.0
This is a mandatory field to indicate that the *.desktop file follows the 1.0 version of the specification.
.TP
Type=Application
This is a mandatory field that indicates that the *.desktop file describes an application launcher.
.TP
Name=\fIApplication Name\fR
The name of the application. For example
\fIMozilla\fR
.TP
GenericName=\fIGeneric Name\fR
A generic description of the application. For example
\fIWeb Browser\fR
.TP
Comment=\fIComment\fR
Optional field to specify a tooltip for the application. For example
\fIVisit websites on the Internet\fR
.TP
Icon=\fIIcon File\fR
The icon to use for the application. This can either be an absolute path to an image file or an icon\-name. If an icon\-name is provided an image lookup by name is done in the user's current icon theme. The
\fBxdg\-icon\-resource\fR
command can be used to install image files into icon themes. The advantage of using an icon\-name instead of an absolute path is that with an icon\-name the application icon can be provided in several different sizes as well as in several differently themed styles.
.TP
Exec=\fICommand Line\fR
The command line to start the application. If the application can open files the %f placeholder should be specified. When a file is dropped on the application launcher the %f is replaced with the file path of the dropped file. If multiple files can be specified on the command line the %F placeholder should be used instead of %f. If the application is able to open URLs in addition to local files then %u or %U can be used instead of %f or %F.
.TP
Categories=\fICategories\fR
A list of categories separated by semi\-colons. A category is a keyword that describes and classifies the application. By default applications are organized in the application menu based on category. When menu entries are explicitly assigned to a new submenu it is not necassery to list any categories.
.sp
When using categories it is recommended to include one of the following categories: AudioVideo, Development, Education, Game, Graphics, Network, Office, Settings, System, Utility.
.sp
See Appendix A of the XDG Desktop Menu Specification for information about additional categories. http://standards.freedesktop.org/menu\-spec/menu\-spec\-1.0.html
.TP
MimeType=\fIMimetypes\fR
A list of mimetypes separated by semi\-colons. This field is used to indicate which file types the application is able to open.
.PP
For a complete oveview of the *.desktop file format please visit http://www.freedesktop.org/wiki/Standards/desktop\-entry\-spec
.SH "DIRECTORY FILES"
.PP
The appearance of submenu in the application menu is provided by a *.directory file. In particular it provides the title of the submenu and a possible icon. A *.directory file consists of a
\fI[Desktop Entry]\fR
header followed by several
\fIKey\fR=\fIValue\fR
lines.
.PP
A *.directory file can provide a title (name) for the submenu in several different languages. This is done by adding a language code as used by LC_MESSAGES in square brackets behind the
\fIKey\fR. This way one can specify different values for the same
\fIKey\fR
depending on the currently selected language.
.PP
The following keys are relevqnt for submenus:
.TP
Value=1.0
This is a mandatory field to indicate that the *.directory file follows the 1.0 version of the Desktop Entry specification.
.TP
Type=Directory
This is a mandatory field that indicates that the *.directory file describes a submenu.
.TP
Name=\fIMenu Name\fR
The title of submenu. For example
\fIMozilla\fR
.TP
Comment=\fIComment\fR
Optional field to specify a tooltip for the submenu.
.TP
Icon=\fIIcon File\fR
The icon to use for the submenu. This can either be an absolute path to an image file or an icon\-name. If an icon\-name is provided an image lookup by name is done in the user's current icon theme. The
\fBxdg\-icon\-resource\fR
command can be used to install image files into icon themes. The advantage of using an icon\-name instead of an absolute path is that with an icon\-name the submenu icon can be provided in several different sizes as well as in several differently themed styles.
.SH "ENVIRONMENT VARIABLES"
.PP
xdg\-desktop\-menu honours the following environment variables:
.TP
XDG_UTILS_DEBUG_LEVEL
Setting this environment variable to a non\-zero numerical value makes xdg\-desktop\-menu do more verbose reporting on stderr. Setting a higher value increases the verbosity.
.TP
XDG_UTILS_INSTALL_MODE
This environment variable can be used by the user or administrator to override the installation mode. Valid values are
\fIuser\fR
and
\fIsystem\fR.
.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.
.TP
\fB5\fR
No permission to read one of the files passed on the command line.
.SH "SEE ALSO"
.PP
\fBxdg\-desktop\-icon\fR(1),
\fBxdg\-icon\-resource\fR(1),
\fBxdg\-mime\fR(1)
.SH "EXAMPLES"
.PP
The company ShinyThings Inc. has developed an application named "WebMirror" and would like to add it to the application menu. The company will use "shinythings" as its vendor id. In order to add the application to the menu there needs to be a .desktop file with a suitable
\fICategories\fR
entry:
.sp
.nf
shinythings\-webmirror.desktop:
[Desktop Entry]
Encoding=UTF\-8
Type=Application
Exec=webmirror
Icon=webmirror
Name=WebMirror
Name[nl]=WebSpiegel
Categories=Network;WebDevelopment;
.fi
.sp
.PP
Now the xdg\-desktop\-menu tool can be used to add the shinythings\-webmirror.desktop file to the desktop application menu:
.sp
.nf
xdg\-desktop\-menu install ./shinythings\-webmirror.desktop
.fi
.sp
.PP
Note that for the purpose of this example the menu items are available in two languages, English and Dutch. The language code for Dutch is nl.
.PP
In the next example the company ShinyThings Inc. will add its own submenu to the desktop application menu consisting of a "WebMirror" menu item and a "WebMirror Admin Tool" menu item.
.PP
First the company needs to create two .desktop files that describe the two menu items. Since the items are to be added to a new submenu it is not necassery to include a Categories= line:
.sp
.nf
shinythings\-webmirror.desktop:
[Desktop Entry]
Encoding=UTF\-8
Type=Application
Exec=webmirror
Icon=shinythings\-webmirror
Name=WebMirror
Name[nl]=WebSpiegel
shinythings\-webmirror\-admin.desktop:
[Desktop Entry]
Encoding=UTF\-8
Type=Application
Exec=webmirror\-admintool
Icon=shinythings\-webmirror\-admintool
Name=WebMirror Admin Tool
Name[nl]=WebSpiegel Administratie Tool
.fi
.sp
.PP
In addition a .directory file needs to be created to provide a title and icon for the sub\-menu itself:
.sp
.nf
shinythings\-webmirror.directory:
[Desktop Entry]
Encoding=UTF\-8
Icon=shinythings\-webmirror\-menu
Name=WebMirror
Name[nl]=WebSpiegel
.fi
.sp
.PP
These file can now be installed with:
.sp
.nf
xdg\-desktop\-menu install ./shinythings\-webmirror.directory \\
./shinythings\-webmirror.desktop ./shinythings\-webmirror\-admin.desktop
.fi
.sp
.PP
The menu entries could also be installed one by one:
.sp
.nf
xdg\-desktop\-menu install \-\-noupdate ./shinythings\-webmirror.directory \\
./shinythings\-webmirror.desktop
xdg\-desktop\-menu install \-\-noupdate ./shinythings\-webmirror.directory \\
./shinythings\-webmirror\-admin.desktop
xdg\-desktop\-menu forceupdate
.fi
.sp
.PP
Although the result is the same it is slightly more efficient to install all files at the same time.
.PP
The *.desktop and *.directory files reference icons with the names webmirror, webmirror\-admin and webmirror\-menu which should also be installed. In this example the icons are installed in two different sizes, once with a size of 22x22 pixels and once with a size of 64x64 pixels:
.sp
.nf
xdg\-icon\-resource install \-\-size 22 ./wmicon\-22.png shinythings\-webmirror
xdg\-icon\-resource install \-\-size 22 ./wmicon\-menu\-22.png shinythings\-webmirror\-menu
xdg\-icon\-resource install \-\-size 22 ./wmicon\-admin\-22.png shinythings\-webmirror\-admin
xdg\-icon\-resource install \-\-size 64 ./wmicon\-64.png shinythings\-webmirror
xdg\-icon\-resource install \-\-size 64 ./wmicon\-menu\-64.png shinythings\-webmirror\-menu
xdg\-icon\-resource install \-\-size 64 ./wmicon\-admin\-64.png shinythings\-webmirror\-admin
.fi
.sp
.SH "AUTHOR"
Kevin Krammer, Jeremy White.
.br
<kevin.krammer@gmx.at>
.br
<jwhite@codeweavers.com>
|