9.2 Customizing Menus
The way in which the GNOME Desktop implements menus enables you
to do the following:
-
Customize the menu hierarchy easily. The menu hierarchy is not
based on the file system hierarchy. You can edit a small number of
files to customize the menu hierarchy. You do not need to modify
your applications or move files.
-
Install applications easily. You do not need to provide
information about the menu hierarchy to applications when you
install the applications.
-
Configure menus so that users cannot modify them.
Menus in the GNOME Desktop use the following components:
9.2.1 Desktop Entry Files
A desktop entry file is a data file that provides information
about an item in a menu. This file specifies the details for the
item such as a name, a command to run, or an icon. It also contains
keywords which determine the location of the item in the menu
hierarchy. Desktop entry files have a .desktop
file extension.
The following is a sample desktop entry file:
[Desktop Entry]
Encoding=UTF-8
Name=Calculator
Comment=Perform calculations
Exec=gcalctool
Icon=gcalctool.png
Terminal=false
Type=Application
Categories=GNOME;Application;Utility;
X-GNOME-DocPath=gcalctool/gcalctool.xml
The following table describes the most important keys in
desktop entry files.
Table 9-7 Desktop Entry File Keys
Encoding |
Specifies the encoding of the desktop entry file. |
Name |
Specifies the name of the item. This name is displayed on
the item in the menu. |
Comment |
Specifies a short description of the item. The comment is
displayed as a tooltip when you point to the item in the menu.
|
Exec |
Specifies a command to execute when you select the item
from the menu. |
Icon |
Specifies the filename of an icon that represents the
item. Does not specify the file extension or the path to the
filename. |
Terminal |
Specifies whether the command in the Exec key runs in a
terminal window. If the value is True, the command runs in a
terminal window.
If the command does not create a window in which to run,
the value of this key must be True. |
Type |
Specifies the type of item. This value is one of the
following:
|
Categories |
Specifies the keywords that describe the item. The
keywords are separated with semicolons (;). To view a list of
the standard category keywords, see the desktop menu
specification at freedesktop.org
The vfolder information files map the keywords to menus.
|
X-GNOME-DocPath |
Specifies the help file to display when you select Help on
application-name from the menu item pop-up menu. |
For more information on the keys in desktop entry files, see
the desktop entry specification at freedesktop.org.
NOTE:Panel launchers and desktop objects also use desktop entry
files. These desktop entry files provide the same information as
for items in a menu. For example, the desktop entry files provide
the command to run when a user selects the launcher or object.
9.2.2 Directory Entry Files
A directory entry file is a data file that provides information
about a menu. The directory entry file specifies the details for the
menu, such as a name, a tooltip, and an icon. Directory entry files
have a .directory file extension.
The following is a sample directory entry file:
[Desktop Entry]
Name=Accessories
Comment=Accessories menu
Icon=gnome-util.png
Type=Directory
The following table describes the most important keys in
directory entry files.
Table 9-8 Directory Entry File Keys
Name |
Specifies the name of the menu, which is displayed on the
menu. |
Comment |
Specifies a short description of the menu. The comment is
displayed as a tooltip when you point to the menu. |
Icon |
Specifies the filename of an icon that represents the
menu. Does not specify the file extension or the path to the
filename. |
Type |
Specifies the type of menu. The value of this key is
always Directory. |
9.2.3 Editing Menus
SUSE Link Enterprise Desktop uses the freedesktop.org menu
specification. This specification uses the following files and
directories:
Table 9-9 Menu File Locations
/etc/xdg/menus/applications.menu
|
This file contains the XML definition for the default
application menu layout. If a user has their own
applications.menu, it replaces the system wide menu. |
/etc/xdg/menus/applications-merged
|
This directory contains the default merge directories
included in the <DefaultMergeDirs> element. You can add
new <Menu> files in this location. |
/etc/xdg/menus/preferences.menu
|
This file contains the XML definition for the GNOME
Control Center. |
For more detailed information on adding and editing menu items,
see the Desktop
Menu Specification Web site.