1XDG-DESKTOP-MENU(1) xdg-desktop-menu Manual XDG-DESKTOP-MENU(1)
2
3
4
6 xdg-desktop-menu - command line tool for (un)installing desktop menu
7 items
8
10 xdg-desktop-menu install [--noupdate] [--novendor] [--mode mode]
11 directory-file(s) desktop-file(s)
12
13 xdg-desktop-menu uninstall [--noupdate] [--mode mode] directory-file(s)
14 desktop-file(s)
15
16 xdg-desktop-menu forceupdate [--mode mode]
17
18 xdg-desktop-menu {--help | --manual | --version}
19
21 The xdg-desktop-menu program can be used to install new menu entries to
22 the desktop's application menu.
23
24 The application menu works according to the XDG Desktop Menu
25 Specification at
26 http://www.freedesktop.org/wiki/Specifications/menu-spec
27
29 install
30 Install one or more applications in a submenu of the desktop menu
31 system.
32
33 desktop-file: A desktop file represents a single menu entry in the
34 menu. Desktop files are defined by the freedesktop.org Desktop
35 Entry Specification. The most important aspects of *.desktop files
36 are summarized below.
37
38 Menu entries can be added to the menu system in two different ways.
39 They can either be added to a predefined submenu in the menu system
40 based on one or more category keywords, or they can be added to a
41 new submenu.
42
43 To add a menu entry to a predefined submenu the desktop file that
44 represents the menu entry must have a Categories= entry that lists
45 one or more keywords. The menu item will be included in an
46 appropriate submenu based on the included keywords.
47
48 To add menu items to a new submenu the desktop-files must be
49 preceded by a directory-file that describes the submenu. If
50 multiple desktop-files are specified, all entries will be added to
51 the same menu. If entries are installed to a menu that has been
52 created with a previous call to xdg-desktop-menu the entries will
53 be installed in addition to any already existing entries.
54
55 directory-file: The *.directory file indicated by directory-file
56 represents a submenu. The directory file provides the name and icon
57 for a submenu. The name of the directory file is used to identify
58 the submenu.
59
60 If multiple directory files are provided each file will represent a
61 submenu within the menu that precedes it, creating a nested menu
62 hierarchy (sub-sub-menus). The menu entries themselves will be
63 added to the last submenu.
64
65 Directory files follow the syntax defined by the freedesktop.org
66 Desktop Entry Specification.
67
68 uninstall
69 Remove applications or submenus from the desktop menu system
70 previously installed with xdg-desktop-menu install.
71
72 A submenu and the associated directory file is only removed when
73 the submenu no longer contains any menu entries.
74
75 forceupdate
76 Force an update of the menu system.
77
78 This command is only useful if the last call to xdg-desktop-menu
79 included the --noupdate option.
80
82 --noupdate
83 Postpone updating the menu system. If multiple updates to the menu
84 system are made in sequence this flag can be used to indicate that
85 additional changes will follow and that it is not necessary to
86 update the menu system right away.
87
88 --novendor
89 Normally, xdg-desktop-menu checks to ensure that any *.directory
90 and *.desktop files to be installed has a vendor prefix. This
91 option can be used 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. The
97 purpose of the vendor prefix is to prevent name conflicts.
98
99 --mode mode
100 mode can be user or system. In user mode the file is (un)installed
101 for the current user only. In system mode the file is (un)installed
102 for all users on the system. Usually only root is allowed to
103 install in system mode.
104
105 The default is to use system mode when called by root and to use
106 user mode when called by a non-root user.
107
108 --help
109 Show command synopsis.
110
111 --manual
112 Show this manual page.
113
114 --version
115 Show the xdg-utils version information.
116
118 An application item in the application menu is represented by a
119 *.desktop file. A *.desktop file consists of a [Desktop Entry] header
120 followed by several Key=Value lines.
121
122 A *.desktop file can provide a name and description for an application
123 in several different languages. This is done by adding a language code
124 as used by LC_MESSAGES in square brackets behind the Key. This way one
125 can specify different values for the same Key depending on the
126 currently selected language.
127
128 The following keys are often used:
129
130 Value=1.0
131 This is a mandatory field to indicate that the *.desktop file
132 follows the 1.0 version of the specification.
133
134 Type=Application
135 This is a mandatory field that indicates that the *.desktop file
136 describes an application launcher.
137
138 Name=Application Name
139 The name of the application. For example Mozilla
140
141 GenericName=Generic Name
142 A generic description of the application. For example Web Browser
143
144 Comment=Comment
145 Optional field to specify a tooltip for the application. For
146 example Visit websites on the Internet
147
148 Icon=Icon File
149 The icon to use for the application. This can either be an absolute
150 path to an image file or an icon-name. If an icon-name is provided
151 an image lookup by name is done in the user's current icon theme.
152 The xdg-icon-resource command can be used to install image files
153 into icon themes. The advantage of using an icon-name instead of an
154 absolute path is that with an icon-name the application icon can be
155 provided in several different sizes as well as in several
156 differently themed styles.
157
158 Exec=Command Line
159 The command line to start the application. If the application can
160 open files the %f placeholder should be specified. When a file is
161 dropped on the application launcher the %f is replaced with the
162 file path of the dropped file. If multiple files can be specified
163 on the command line the %F placeholder should be used instead of
164 %f. If the application is able to open URLs in addition to local
165 files then %u or %U can be used instead of %f or %F.
166
167 Categories=Categories
168 A list of categories separated by semi-colons. A category is a
169 keyword that describes and classifies the application. By default
170 applications are organized in the application menu based on
171 category. When menu entries are explicitly assigned to a new
172 submenu it is not necessary to list any categories.
173
174 When using categories it is recommended to include one of the
175 following categories: AudioVideo, Development, Education, Game,
176 Graphics, Network, Office, Settings, System, Utility.
177
178 See Appendix A of the XDG Desktop Menu Specification for
179 information about additional categories:
180 http://standards.freedesktop.org/menu-spec/menu-spec-1.0.html#category-registry
181
182 MimeType=Mimetypes
183 A list of mimetypes separated by semi-colons. This field is used to
184 indicate which file types the application is able to open.
185
186 For a complete overview of the *.desktop file format please visit
187 http://www.freedesktop.org/wiki/Specifications/desktop-entry-spec
188
190 The appearance of submenu in the application menu is provided by a
191 *.directory file. In particular it provides the title of the submenu
192 and a possible icon. A *.directory file consists of a [Desktop Entry]
193 header followed by several Key=Value lines.
194
195 A *.directory file can provide a title (name) for the submenu in
196 several different languages. This is done by adding a language code as
197 used by LC_MESSAGES in square brackets behind the Key. This way one can
198 specify different values for the same Key depending on the currently
199 selected language.
200
201 The following keys are relevant for submenus:
202
203 Value=1.0
204 This is a mandatory field to indicate that the *.directory file
205 follows the 1.0 version of the Desktop Entry specification.
206
207 Type=Directory
208 This is a mandatory field that indicates that the *.directory file
209 describes a submenu.
210
211 Name=Menu Name
212 The title of submenu. For example Mozilla
213
214 Comment=Comment
215 Optional field to specify a tooltip for the submenu.
216
217 Icon=Icon File
218 The icon to use for the submenu. This can either be an absolute
219 path to an image file or an icon-name. If an icon-name is provided
220 an image lookup by name is done in the user's current icon theme.
221 The xdg-icon-resource command can be used to install image files
222 into icon themes. The advantage of using an icon-name instead of an
223 absolute path is that with an icon-name the submenu icon can be
224 provided in several different sizes as well as in several
225 differently themed styles.
226
228 xdg-desktop-menu honours the following environment variables:
229
230 XDG_UTILS_DEBUG_LEVEL
231 Setting this environment variable to a non-zero numerical value
232 makes xdg-desktop-menu do more verbose reporting on stderr. Setting
233 a higher value increases the verbosity.
234
235 XDG_UTILS_INSTALL_MODE
236 This environment variable can be used by the user or administrator
237 to override the installation mode. Valid values are user and
238 system.
239
241 An exit code of 0 indicates success while a non-zero exit code
242 indicates failure. The following failure codes can be returned:
243
244 1
245 Error in command line syntax.
246
247 2
248 One of the files passed on the command line did not exist.
249
250 3
251 A required tool could not be found.
252
253 4
254 The action failed.
255
256 5
257 No permission to read one of the files passed on the command line.
258
260 xdg-desktop-icon(1), xdg-icon-resource(1), xdg-mime(1)
261
263 The company ShinyThings Inc. has developed an application named
264 "WebMirror" and would like to add it to the application menu. The
265 company will use "shinythings" as its vendor id. In order to add the
266 application to the menu there needs to be a .desktop file with a
267 suitable Categories entry:
268
269 shinythings-webmirror.desktop:
270
271 [Desktop Entry]
272 Encoding=UTF-8
273 Type=Application
274
275 Exec=webmirror
276 Icon=webmirror
277
278 Name=WebMirror
279 Name[nl]=WebSpiegel
280
281 Categories=Network;WebDevelopment;
282
283 Now the xdg-desktop-menu tool can be used to add the
284 shinythings-webmirror.desktop file to the desktop application menu:
285
286 xdg-desktop-menu install ./shinythings-webmirror.desktop
287
288 Note that for the purpose of this example the menu items are available
289 in two languages, English and Dutch. The language code for Dutch is nl.
290
291 In the next example the company ShinyThings Inc. will add its own
292 submenu to the desktop application menu consisting of a "WebMirror"
293 menu item and a "WebMirror Admin Tool" menu item.
294
295 First the company needs to create two .desktop files that describe the
296 two menu items. Since the items are to be added to a new submenu it is
297 not necessary to include a Categories= line:
298
299 shinythings-webmirror.desktop:
300
301 [Desktop Entry]
302 Encoding=UTF-8
303 Type=Application
304
305 Exec=webmirror
306 Icon=shinythings-webmirror
307
308 Name=WebMirror
309 Name[nl]=WebSpiegel
310
311
312 shinythings-webmirror-admin.desktop:
313
314 [Desktop Entry]
315 Encoding=UTF-8
316 Type=Application
317
318 Exec=webmirror-admintool
319 Icon=shinythings-webmirror-admintool
320
321 Name=WebMirror Admin Tool
322 Name[nl]=WebSpiegel Administratie Tool
323
324 In addition a .directory file needs to be created to provide a title
325 and icon for the sub-menu itself:
326
327 shinythings-webmirror.directory:
328
329 [Desktop Entry]
330 Encoding=UTF-8
331
332 Icon=shinythings-webmirror-menu
333
334 Name=WebMirror
335 Name[nl]=WebSpiegel
336
337 These file can now be installed with:
338
339 xdg-desktop-menu install ./shinythings-webmirror.directory \
340 ./shinythings-webmirror.desktop ./shinythings-webmirror-admin.desktop
341
342 The menu entries could also be installed one by one:
343
344 xdg-desktop-menu install --noupdate ./shinythings-webmirror.directory \
345 ./shinythings-webmirror.desktop
346 xdg-desktop-menu install --noupdate ./shinythings-webmirror.directory \
347 ./shinythings-webmirror-admin.desktop
348 xdg-desktop-menu forceupdate
349
350 Although the result is the same it is slightly more efficient to
351 install all files at the same time.
352
353 The *.desktop and *.directory files reference icons with the names
354 webmirror, webmirror-admin and webmirror-menu which should also be
355 installed. In this example the icons are installed in two different
356 sizes, once with a size of 22x22 pixels and once with a size of 64x64
357 pixels:
358
359 xdg-icon-resource install --size 22 ./wmicon-22.png shinythings-webmirror
360 xdg-icon-resource install --size 22 ./wmicon-menu-22.png shinythings-webmirror-menu
361 xdg-icon-resource install --size 22 ./wmicon-admin-22.png shinythings-webmirror-admin
362 xdg-icon-resource install --size 64 ./wmicon-64.png shinythings-webmirror
363 xdg-icon-resource install --size 64 ./wmicon-menu-64.png shinythings-webmirror-menu
364 xdg-icon-resource install --size 64 ./wmicon-admin-64.png shinythings-webmirror-admin
365
366
368 Kevin Krammer
369 Author.
370
371 Jeremy White
372 Author.
373
375 Copyright © 2006
376
377
378
379xdg-utils 1.0 11/05/2016 XDG-DESKTOP-MENU(1)