blob: a7e0772e9fe0aa8eaf920c7d80ebcf1a9262f400 (
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
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
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>xdg-menu</title><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="xdg-menu"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>xdg-menu — command line tool for (un)installing desktop menu items</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">xdg-menu</code> install [<code class="option">--noupdate</code>] [<code class="option">--vendor <em class="replaceable"><code>vendor-id</code></em></code>] { <code class="option">--user</code> | <code class="option">--system</code> } { <em class="replaceable"><code>desktop-file</code></em> | <em class="replaceable"><code>menu-file</code></em> | <em class="replaceable"><code>directory-file</code></em> }</p></div><div class="cmdsynopsis"><p><code class="command">xdg-menu</code> uninstall [<code class="option">--noupdate</code>] [<code class="option">--vendor <em class="replaceable"><code>vendor-id</code></em></code>] { <code class="option">--user</code> | <code class="option">--system</code> } { <em class="replaceable"><code>desktop-file</code></em> | <em class="replaceable"><code>menu-file</code></em> | <em class="replaceable"><code>directory-file</code></em> }</p></div><div class="cmdsynopsis"><p><code class="command">xdg-menu</code> forceupdate { <code class="option">--user</code> | <code class="option">--system</code> }</p></div><div class="cmdsynopsis"><p><code class="command">xdg-menu</code> { <code class="option">--help</code> | <code class="option">--manual</code> | <code class="option">--version</code> }</p></div></div><div class="refsect1" lang="en"><a name="description"></a><h2>Description</h2><p>
The xdg-menu program can be used to install new items to the
desktop's application menu.
</p><p>
The application menu works according to the
XDG Desktop Menu Specification at
http://www.freedesktop.org/Standards/menu-spec
</p></div><div class="refsect1" lang="en"><a name="commands"></a><h2>Commands</h2><div class="variablelist"><dl><dt><span class="term">install</span></dt><dd><p>
Install applications or submenus into the desktop menu system.
</p><p><em class="replaceable"><code>desktop-file</code></em>:
Installs the *.desktop file indicated by <em class="replaceable"><code>desktop-file</code></em>
to the menu system. A desktop file represents a single application in the menu.
Desktop files are defined by the freedesktop.org Desktop Entry
Specification. The most important aspects of *.desktop
files are summarized below.
</p><p><em class="replaceable"><code>menu-file</code></em>:
Installs the *.menu file indicated by <em class="replaceable"><code>menu-file</code></em>
to the menu system. A menu file describes the location and contents for
one or more new submenus. Each submenu must reference a *.directory file.
</p><p><em class="replaceable"><code>directory-file</code></em>:
Installs the *.directory file indicated by <em class="replaceable"><code>directory-file</code></em>
to the menu system. A directory file provides the name and icon for a submenu.
</p></dd><dt><span class="term">uninstall</span></dt><dd>
Remove applications or submenus from the desktop menu system
previously installed with <span><strong class="command">xdg-menu install</strong></span>.
</dd><dt><span class="term">forceupdate</span></dt><dd>
Force an update of the menu system. This is only useful if
the last call to xdg-menu included the <code class="option">--noupdate</code> option.
</dd></dl></div></div><div class="refsect1" lang="en"><a name="options"></a><h2>Options</h2><div class="variablelist"><dl><dt><span class="term"><code class="option">--noupdate</code></span></dt><dd>
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.
</dd><dt><span class="term"> <code class="option">--vendor</code> <em class="replaceable"><code>vendor-id</code></em></span></dt><dd>
Adds <em class="replaceable"><code>vendor-id</code></em> as a prefix when installing desktop
and directory files.
</dd><dt><span class="term"><code class="option">--user</code></span></dt><dd>
Installs or uninstalls the file for the current user only.
</dd><dt><span class="term"><code class="option">--system</code></span></dt><dd>
Installs or uninstalls the file for all users on the system.
Usually only root is allowed to do this.
</dd><dt><span class="term"><code class="option">--help</code></span></dt><dd>
Show command synopsis.
</dd><dt><span class="term"><code class="option">--manual</code></span></dt><dd>
Show this manualpage.
</dd><dt><span class="term"><code class="option">--version</code></span></dt><dd>
Show the xdg-utils version information.
</dd></dl></div></div><div class="refsect1" lang="en"><a name="desktopfiles"></a><h2>Desktop Files</h2><p>
An application item in the application menu is represented by a
*.desktop file. A *.desktop file consists of a
<span class="emphasis"><em>[Desktop Entry]</em></span> header followed by several
<em class="replaceable"><code>Key</code></em>=<em class="replaceable"><code>Value</code></em> lines.
</p><p>
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
<em class="replaceable"><code>Key</code></em>. This way one can specify different
values for the same <em class="replaceable"><code>Key</code></em> depending on the
currently selected language.
</p><p>
The following keys are often used:
</p><div class="variablelist"><dl><dt><span class="term">Value=1.0</span></dt><dd>
This is a mandatory field to indicate that the *.desktop file
follows the 1.0 version of the specification.
</dd><dt><span class="term">Type=Application</span></dt><dd>
This is a mandatory field that indicates that the *.desktop file
describes an application launcher.
</dd><dt><span class="term">Name=<em class="replaceable"><code>Application Name</code></em></span></dt><dd>
The name of the application.
For example <span class="emphasis"><em>Mozilla</em></span>
</dd><dt><span class="term">GenericName=<em class="replaceable"><code>Generic Name</code></em></span></dt><dd>
A generic description of the application.
For example <span class="emphasis"><em>Web Browser</em></span>
</dd><dt><span class="term">Comment=<em class="replaceable"><code>Comment</code></em></span></dt><dd>
Optional field to specify a tooltip for the application.
For example <span class="emphasis"><em>Visit websites on the Internet</em></span>
</dd><dt><span class="term">Icon=<em class="replaceable"><code>Icon File</code></em></span></dt><dd>
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 <span><strong class="command">xdg-icon</strong></span>
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.
</dd><dt><span class="term">Exec=<em class="replaceable"><code>Command Line</code></em></span></dt><dd>
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.
</dd><dt><span class="term">Categories=<em class="replaceable"><code>Categories</code></em></span></dt><dd>
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. The XDG Desktop Menu Specification defines
a large number of predefined categories.
</dd><dt><span class="term">MimeType=<em class="replaceable"><code>Mimetypes</code></em></span></dt><dd>
A list of mimetypes separated by semi-colons. This field is
used to indicate which file types the application is able to
open.
</dd></dl></div><p>
For a complete oveview of the *.desktop file format please
visit http://www.freedesktop.org/wiki/Standards/desktop-entry-spec
</p></div><div class="refsect1" lang="en"><a name="exitcodes"></a><h2>Exit Codes</h2><p>
An exit code of 0 indicates success while a non-zero exit code
indicates failure. The following failure codes can be returned:
</p><div class="variablelist"><dl><dt><span class="term"><code class="option">1</code></span></dt><dd>
Error in command line syntax.
</dd><dt><span class="term"><code class="option">2</code></span></dt><dd>
One of the files passed on the command line did not exist.
</dd><dt><span class="term"><code class="option">3</code></span></dt><dd>
A required tool could not be found.
</dd><dt><span class="term"><code class="option">4</code></span></dt><dd>
The action failed.
</dd></dl></div></div><div class="refsect1" lang="en"><a name="seealso"></a><h2>See Also</h2><p><span class="citerefentry"><span class="refentrytitle">xdg-desktop</span>(1)</span>,
<span class="citerefentry"><span class="refentrytitle">xdg-icon</span>(1)</span>,
<span class="citerefentry"><span class="refentrytitle">xdg-mime</span>(1)</span>
</p></div><div class="refsect1" lang="en"><a name="examples"></a><h2>Examples</h2><p>
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 <span class="emphasis"><em>Categories</em></span> entry:
</p><pre class="programlisting">
webmirror.desktop:
[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=webmirror
Icon=webmirror
Name=WebMirror
Name[nl]=WebSpiegel
Categories=Network;WebDevelopment;
</pre><p>
</p><p>Now the xdg-menu tool can be used to add the webmirror.desktop file
to the desktop application menu:
</p><pre class="programlisting">
xdg-menu install --system --vendor shinythings ./webmirror.desktop
</pre><p>
</p><p>
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.
</p><p>
In the next example the company ShinyThings Inc. wants to add its own
submenu to the desktop application menu consisting of a
"WebMirror" menu item and a
"WebMirror Admin Tool" menu item.
</p><p>
First the company needs to create two .desktop files that describe
the two menu items, this time no Categories item is needed:
</p><pre class="programlisting">
webmirror.desktop:
[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=webmirror
Icon=webmirror
Name=WebMirror
Name[nl]=WebSpiegel
webmirror-admin.desktop:
[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=webmirror-admintool
Icon=webmirror-admintool
Name=WebMirror Admin Tool
Name[nl]=WebSpiegel Administratie Tool
</pre><p>
</p><p>
The files can be installed with:
</p><pre class="programlisting">
xdg-menu install --system --noupdate --vendor shinythings ./webmirror.desktop
xdg-menu install --system --noupdate --vendor shinythings ./webmirror-admin.desktop
</pre><p>
</p><p>
Because multiple items are added the <code class="option">--noupdate</code>
option has been used.
</p><p>
In addition a .directory file needs to be created to provide a title and icon
for the sub-menu itself:
</p><pre class="programlisting">
webmirror.directory:
[Desktop Entry]
Encoding=UTF-8
Icon=webmirror-menu
Name=WebMirror
Name[nl]=WebSpiegel
</pre><p>
</p><p>
This webmirror.directory file can be installed with:
</p><pre class="programlisting">
xdg-menu install --system --noupdate --vendor shinythings ./webmirror.directory
</pre><p>
</p><p>
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:
</p><pre class="programlisting">
xdg-icon install --system --size 22 ./wmicon-22.png webmirror.png
xdg-icon install --system --size 22 ./wmicon-menu-22.png webmirror-menu.png
xdg-icon install --system --size 22 ./wmicon-admin-22.png webmirror-admin.png
xdg-icon install --system --size 64 ./wmicon-64.png webmirror.png
xdg-icon install --system --size 64 ./wmicon-menu-64.png webmirror-menu.png
xdg-icon install --system --size 64 ./wmicon-admin-64.png webmirror-admin.png
</pre><p>
</p><p>
The last step is to provide a .menu file that links it all
togther:
</p><pre class="programlisting">
webmirror.menu:
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 0.8//EN"
"http://www.freedesktop.org/standards/menu-spec/menu-0.8.dtd">
<Menu>
<Menu>
<Name>WebMirror</Name>
<Directory>shinythings-webmirror.directory</Directory>
<Include>
<Filename>shinythings-webmirror.desktop</Filename>
<Filename>shinythings-webmirror-admin.desktop</Filename>
</Include>
</Menu>
</Menu>
</pre><p>
</p><p>
The webmirror.menu file can be installed with:
</p><pre class="programlisting">
xdg-menu install --system --noupdate --vendor shinythings ./webmirror.menu
</pre><p>
</p><p>
After installing multiple files with <code class="option">--noupdate</code> make sure
to force an update:
</p><pre class="programlisting">
xdg-menu forceupdate --system
</pre><p>
</p></div></div></body></html>
|