Task Description
Install/remove/update a menu item
Analysis
The http://www.freedesktop.org/wiki/Standards/menu-spec standardizes menu handling. It relies on http://www.freedesktop.org/wiki/Standards/basedir-spec to define directory locations and http://www.freedesktop.org/wiki/Standards/desktop-entry-spec for the definition of .desktop files.
Most notable is the ISV guide that is part of the menu-spec: http://standards.freedesktop.org/menu-spec/latest/apc.html
Additional pages that touch on this topic:
http://developers.sun.com/solaris/articles/integrating_gnome.html
http://studio.imagemagick.org/pipermail/magick-developers/2004-August/002002.html
A menu item is represented by a .desktop file. The .desktop file needs to placed in one of the predefined menu directories, such as /usr/share/applications. A Category= line in the .desktop file defines keywords that describe the application, the application is placed in the menu based on these keywords.
The .desktop file can specify an icon for the menu item either as absolute path or by name based on the http://www.freedesktop.org/wiki/Standards/icon-theme-spec .
After installing a .desktop file the update-desktop-database command must be called to force an update of a potential cache for .desktop files. [Query by JeremyWhite - Is this really true? Empirically, I've not seen evidence of this, and I've also seen little or no documentation of this fact. Answer by Waldo Bastian - Gnome/Nautilus needs it, see for example http://lists.debian.org/debian-gtk-gnome/2005/04/msg00053.html ]
Existing Solutions
The desktop-file-utils package on http://www.freedesktop.org/wiki/Software/desktop-file-utils includes a tool named desktop-file-install to install .desktop files
Proposed Solution
See xdg-desktop-menu in the xdg-utils directory of the Portland CVS module.
Known Problems
- The location of the update-desktop-database tool is not specified and depends from distribution to distribution.
- There is no guidance in which exact directory the .desktop file should be placed.
- It can be unclear which keywords should be used. The exact location in the menu for a certain set of keywords can be unclear and can differ between distributions.


