By refdoc at 2005-08-24 17:04
How the menu is build:
/etc/xdg/applications is a Glade xml file, building the application menu.
It uses category/directory entries in /usr/share/desktop-directories (e.g. "Games", Graphics" etc), application entries in /usr/share/applications and icons in /usr/share/pixmaps.
A well-build application entry in the directory /usr/share/applications will simply be added to the existing menu. To add a new category-directory to the menu, both /etc/xdg/applications must be altered and a new entry in /usr/share/desktop-directories must be added.
Adding a an application to the menu:
Application menu items are text files with following compulsory content:
A useful addition is a line describing the application
To make sure application appears only in one desktop environment of several installed include a line
Other possible additions are Names in other locales, whether an application will run in a terminal etc.
Adding a new category is a bit more complicated.
Firstly /etc/xdg/menus/applications must be edited by adding somewhere in the toplevel section <Menu> after the legacy menu entry description.
The file is in XML format and will be used to build up the menu. If you add your entry make sure that the XML file remains well formed.
<!-- MyCategoryCommentary -->
</Menu> <!-- End MyCategory -->
Secondly an entry in /usr/share/desktop-directories must be added. This should be again a simple text file with following compulsory content:
The file must be named <MyCategory>.desktop
Menu categories can be nested multiple times, but this should be discouraged. The beauty of the new Gnome menu system is its simplicity.
The multiplicity of legacy menu systems in gnome and competing menu systems in KDE etc can make menus in Gnome quite messy. My personal solution was to search out all entries added by the legacy systems and adding them in the new way. Quite a few (even new-ish Gnome applications) put their entries into are the subdirectories of /usr/share/apps. After addition of a line
the entries there can simply be moved to /usr/share/applications.
For reasons unknown to me sometime new menu items do not immediately appear in the menu. Usually this is solved by restarting X.