blob: 71b7e045524f2eed7e5b2e0e902e589bca9566c6 [file] [log] [blame]
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>xdg-desktop-menu</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" title="xdg-desktop-menu"><a name="xdg-desktop-menu"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>xdg-desktop-menu &#8212; command line tool for (un)installing desktop menu items</p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">xdg-desktop-menu</code> install [<code class="option">--noupdate</code>] [<code class="option">--novendor</code>] [<code class="option">--mode <em class="replaceable"><code>mode</code></em></code>] <em class="replaceable"><code>directory-file(s)</code></em> <em class="replaceable"><code>desktop-file(s)</code></em> </p></div><div class="cmdsynopsis"><p><code class="command">xdg-desktop-menu</code> uninstall [<code class="option">--noupdate</code>] [<code class="option">--mode <em class="replaceable"><code>mode</code></em></code>] <em class="replaceable"><code>directory-file(s)</code></em> <em class="replaceable"><code>desktop-file(s)</code></em> </p></div><div class="cmdsynopsis"><p><code class="command">xdg-desktop-menu</code> forceupdate [<code class="option">--mode <em class="replaceable"><code>mode</code></em></code>]</p></div><div class="cmdsynopsis"><p><code class="command">xdg-desktop-menu</code> { <code class="option">--help</code> | <code class="option">--manual</code> | <code class="option">--version</code> }</p></div></div><div class="refsect1" title="Description"><a name="description"></a><h2>Description</h2><p>
The xdg-desktop-menu program can be used to install new menu entries
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" title="Commands"><a name="commands"></a><h2>Commands</h2><div class="variablelist"><dl><dt><span class="term">install</span></dt><dd><p class="simpara">
Install one or more applications in a submenu of
the desktop menu system.
</p><p class="simpara"><em class="replaceable"><code>desktop-file</code></em>:
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.
</p><p class="simpara">
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.
</p><p class="simpara">
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.
</p><p class="simpara">
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
<span class="command"><strong>xdg-desktop-menu</strong></span> the entries will be
installed in addition to any already existing entries.
</p><p class="simpara"><em class="replaceable"><code>directory-file</code></em>:
The *.directory file indicated by
<em class="replaceable"><code>directory-file</code></em> 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.
</p><p class="simpara">
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.
</p><p class="simpara">
Directory files follow the syntax defined by the freedesktop.org
Desktop Entry Specification.
</p></dd><dt><span class="term">uninstall</span></dt><dd><p class="simpara">
Remove applications or submenus from the desktop menu system
previously installed with <span class="command"><strong>xdg-desktop-menu install</strong></span>.
</p><p class="simpara">
A submenu and the associated directory file is only removed
when the submenu no longer contains any menu entries.
</p></dd><dt><span class="term">forceupdate</span></dt><dd><p class="simpara">
Force an update of the menu system.
</p><p class="simpara">
This command is only useful if the last call to
xdg-desktop-menu included the <code class="option">--noupdate</code> option.
</p></dd></dl></div></div><div class="refsect1" title="Options"><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">--novendor</code></span></dt><dd><p class="simpara">
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.
</p><p class="simpara">
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.
</p></dd><dt><span class="term"><code class="option">--mode</code> <em class="replaceable"><code>mode</code></em></span></dt><dd><p class="simpara"><em class="replaceable"><code>mode</code></em> can be
<span class="emphasis"><em>user</em></span> or <span class="emphasis"><em>system</em></span>.
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.
</p><p class="simpara">
The default is to use system mode when called by root
and to use user mode when called by a non-root user.
</p></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" title="Desktop Files"><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 class="command"><strong>xdg-icon-resource</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><p class="simpara">
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.
</p><p class="simpara">
When using categories it is recommended to include
one of the following categories:
AudioVideo, Development, Education, Game, Graphics, Network,
Office, Settings, System, Utility.
</p><p class="simpara">
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
</p></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" title="Directory Files"><a name="directoryfiles"></a><h2>Directory Files</h2><p>
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
<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 *.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
<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 relevqnt for submenus:
</p><div class="variablelist"><dl><dt><span class="term">Value=1.0</span></dt><dd>
This is a mandatory field to indicate that the *.directory file
follows the 1.0 version of the Desktop Entry specification.
</dd><dt><span class="term">Type=Directory</span></dt><dd>
This is a mandatory field that indicates that the *.directory file
describes a submenu.
</dd><dt><span class="term">Name=<em class="replaceable"><code>Menu Name</code></em></span></dt><dd>
The title of submenu.
For example <span class="emphasis"><em>Mozilla</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 submenu.
</dd><dt><span class="term">Icon=<em class="replaceable"><code>Icon File</code></em></span></dt><dd>
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 <span class="command"><strong>xdg-icon-resource</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 submenu icon can be
provided in several different sizes as well as in several
differently themed styles.
</dd></dl></div></div><div class="refsect1" title="Environment Variables"><a name="env_vars"></a><h2>Environment Variables</h2><p>
xdg-desktop-menu honours the following environment variables:
</p><div class="variablelist"><dl><dt><span class="term">XDG_UTILS_DEBUG_LEVEL</span></dt><dd>
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.
</dd><dt><span class="term">XDG_UTILS_INSTALL_MODE</span></dt><dd>
This environment variable can be used by the user or
administrator to override the installation mode.
Valid values are <span class="emphasis"><em>user</em></span> and
<span class="emphasis"><em>system</em></span>.
</dd></dl></div></div><div class="refsect1" title="Exit Codes"><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><dt><span class="term"><code class="option">5</code></span></dt><dd>
No permission to read one of the files passed on the command
line.
</dd></dl></div></div><div class="refsect1" title="See Also"><a name="seealso"></a><h2>See Also</h2><p><span class="citerefentry"><span class="refentrytitle">xdg-desktop-icon</span>(1)</span>,
<span class="citerefentry"><span class="refentrytitle">xdg-icon-resource</span>(1)</span>,
<span class="citerefentry"><span class="refentrytitle">xdg-mime</span>(1)</span>
</p></div><div class="refsect1" title="Examples"><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">
shinythings-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-desktop-menu tool can be used to add the
shinythings-webmirror.desktop file to the desktop application menu:
</p><pre class="programlisting">
xdg-desktop-menu install ./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. will 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. Since the items are to be added to a new submenu
it is not necassery to include a Categories= line:
</p><pre class="programlisting">
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
</pre><p>
</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">
shinythings-webmirror.directory:
[Desktop Entry]
Encoding=UTF-8
Icon=shinythings-webmirror-menu
Name=WebMirror
Name[nl]=WebSpiegel
</pre><p>
</p><p>
These file can now be installed with:
</p><pre class="programlisting">
xdg-desktop-menu install ./shinythings-webmirror.directory \
./shinythings-webmirror.desktop ./shinythings-webmirror-admin.desktop
</pre><p>
</p><p>
The menu entries could also be installed one by one:
</p><pre class="programlisting">
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
</pre><p>
</p><p>
Although the result is the same it is slightly more efficient to
install all files at the same time.
</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-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
</pre><p>
</p></div></div></body></html>