Customizing Menus

SUSE Linux Enterprise10 lets you edit menus in either of the following ways:

Customizing the GNOME Main Menu with Alacarte

The Alacarte application enables you to customize the GNOME Main menu. Users can edit their own menus, and administrators can customize the menu for all users with accounts on the computer. The system-wide menu can also be distributed to other computers.

[Note]Note

Changes you have made to the Main menu are not overwritten during a subsequent system update. Changes are applied after the latest menu view is generated.

This section contains the following information:

Installing Alacarte

Alacarte is not installed when you install SUSE Linux Enterprise Desktop. To install Alacarte:

  1. Click Computer Control Center System YaST.

    YaST Control Center opens.

  2. (Conditional) If prompted, enter the root password.

  3. Click Software Software Management.

  4. In the search box, type alacarte, then click Search.

  5. Select alacarte, then click Accept.

  6. When prompted, insert the specified installation medium.

    For example, if you are using CDs, insert SUSE Linux Enterprise Desktop CD 2.

  7. Click OK.

    Wait a few moments while the system checks dependencies, then installs Alacarte.

  8. When asked whether you want to install more packages, click No.

Alacarte is now installed and two icons are added to the GNOME Control Center.

Starting Alacarte

  1. Click Computer Control Center Look and Feel.

  2. Click Main Menu Editor.

    There are two Main Menu Editor icons. Mouse over them to determine which is used for system-wide changes and which is used for your own local menu. Use the system-wide version if you are modifying a menu for all users on your system or want to distribute the menu to other computers. Use the regular version to modify your own menu.

The Menu Layout window opens.

Figure 10.2. Alacarte Menu Layout Window

Alacarte Menu Layout Window

You can now edit the menu.

Editing the Menu

This section describes the following ways you can edit the Main menu:

[Important]Important

The first time you use Alacarte, changes to the menu do not take effect until you log out and log back in. After the first time, changes appear immediately when you make them.

[Note]Note

Some features of Alacarte, such as the ability to nest groups and insert separators, apply only if you use older versions of the GNOME menu.

Finding Menu Items

The Menu Layout window is arranged with the Main menu submenus in the Menus list on the left and the items in the selected menu in the Items list on the right. Groups in a submenu are nested below that submenu. To find an item, click the arrow next to a submenu in the Menus list, select the group containing that item, then locate the item in the Items list.

For example, to locate the Sound Recorder application:

  1. Start Alacarte as described in Section 10.2.1.2, “Starting Alacarte”.

  2. Click the arrow next to the Audio & Video submenu in the Menus list, then select the Recording group.

  3. Locate Sound Recorder in the Items list.

Rearranging Menu Items

You can use Alacarte to change the order in which items appear in the Main menu. For example, you might want to place your frequently used applications at the top of the menu or at the top of their groups to make them easier to find.

To move an item, click it and drag it to a new location in the menu. You can move the item to a new location in the same menu, or drop it on an item in the Menus list to move it to a new menu or group.

Creating New Separators

Separators serve as visual cues to make it easier to find items in menus.

[Note]Note

Separators are not used in the current version of the GNOME menu. Adding a separator will have no effect. However, if you install and use an older version of the GNOME menu, you can use separators.

To create a separator:

  1. Select the item above the space where you want the separator to appear.

    For help locating an item, see Section 10.2.1.3.1, “Finding Menu Items”.

  2. Click New Separator.

The new separator appears beneath the selected item in the Items list. You can drag the separator to a new location like you would any other menu item. To delete a separator, see Section 10.2.1.3.5, “Deleting Items from the Main Menu”.

Showing or Hiding Menu Items

To show or hide an item, locate the item in the Items list, then select or deselect the box next to that item. When you hide an item, it remains in Items list and can be shown at another time if you decide you want it to appear in the menu. To delete an item from the Items list, see Section 10.2.1.3.5, “Deleting Items from the Main Menu”.

Deleting Items from the Main Menu

There are two ways to remove an item from the Main menu:

  • To remove an item but retain it in the Items list so you can easily add it to the menu, hide the item as explained in Section 10.2.1.3.4, “Showing or Hiding Menu Items”.

  • To delete an item from the Items list so it can no longer be shown, right-click the item and click Delete.

[Note]Note

Separators can not be hidden. They can only be added or deleted.

If you want to show a deleted item, you must add it like you would a new application. See Section 10.2.1.3.8, “Adding New Items to the Main Menu” for information about adding an application.

Renaming Menu Items

  1. Locate the menu item whose name you want to change, as explained in Section 10.2.1.3.1, “Finding Menu Items”.

  2. Right-click the item, then click Properties.

  3. Replace the current name with the name you want to give the item, then click Close.

The old name is replaced by the new one in the menu.

Changing an Item’s Generic Name

A short descriptive name appears beneath the name of each item in the Main menu. This is known as the generic name. To change the generic name:

  1. Locate the menu item whose generic name you want to change, as explained in Section 10.2.1.3.1, “Finding Menu Items”.

  2. Right-click the item, then click Properties.

  3. Replace the current generic name with the generic name you want to give the item, then click Close.

The old generic name is replaced by the new one in the menu.

Adding New Items to the Main Menu

You can add a new item to the Main menu. This is especially helpful when you install an application, but it is also useful if you have other applications that do not currently appear on the menu. You can also add a directory, a link, or another type of item to the menu.

To add an application to the Main menu:

  1. In the Menus list, click the arrow next to the menu containing the group where you want to add the application, then select the group.

    The contents of that group appear in the Items list.

  2. Click New Item.

  3. Type a name and generic name for the item.

  4. Click Browse and browse to the item.

  5. Select the item.

  6. Click the Type list, then select the type of item.

    For example, if you are adding a directory, click the list and select Directory. If you are adding an application, leave the default item type, Application, as is.

  7. (Optional) To assign an icon to the new item, click No Icon, then select an icon for the item.

    If you do not select an icon, the item appears in the menu without an icon.

  8. Click Close.

After the item is added to the menu, you can move it to the place where you want it to appear in the menu, as described in Section 10.2.1.3.2, “Rearranging Menu Items”.

Changing the Maximum Number of Items Allowed in the New Applications Group

When you install an application, it is usually added in its group in the Main menu, as well as to the New Applications group.

[Note]Note

Some applications do not add themselves to the menu when installed. You can add these applications to the Main menu yourself, using the instructions provided in Section 10.2.1.3.8, “Adding New Items to the Main Menu”.

By default, the New Applications group holds up to nine items. After the ninth new application is added, subsequent new applications replace the oldest item in the group.

To change the maximum number of applications allowed in the New Applications group:

  1. Open Alacarte.

  2. Click the up-arrow or down-arrow next to Application Browser: Max items in New Applications Group to increase or decrease the number.

  3. Click Close.

Changing a System-Wide Menu

Alacarte enables you to edit the system-wide Main menu for all users on the system, and distribute it to other computers. These additional systems need not have an identical setup to use the new menu.

[Note]Note

Changing the system-wide menu requires administrative privileges for the computer whose menu you want to change.

To change a system-wide menu and distribute it:

  1. Open Alacarte, using the launcher for the system-wide menu editor.

    See Section 10.2.1.2, “Starting Alacarte” for more information.

  2. Enter the root password.

  3. Make the desired changes to the menu, as described in Section 10.2.1.3, “Editing the Menu”.

  4. Click Close.

The changes you made now appear for all users of the system.

Distributing a System-Wide Menu to Other Computers

The changes you make to the system-wide menu are saved in the /etc/opt/gnome/alacarte-system directory. To use this menu on other computers:

  1. Copy the /etc/opt/gnome/alacarte-system directory to the other computers.

  2. Copy the following lines from the /etc/profile.d/xdg-enviroment.sh file on the original system to the /etc/profile.d/xdg-enviroment.sh file on the target system:

    #START SECTION ADDED BY ALACARTE
    export XDG_DATA_DIRS=/etc/opt/gnome/alacarte_system:$XDG_DATA_DIRS
    export XDG_CONFIG_DIRS=/etc/opt/gnome/alacarte_system:$XDG_CONFIG_DIRS
    #END SECTION ADDED BY ALACARTE
    

Customizing GNOME Menus Using Desktop and Directory Entry Files

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:

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 10.7. Desktop Entry File Keys

Desktop Entry Key

Description

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:

  • Application: Use this option for an item that starts an application.

  • Link: Use this option for an item that links to a file, folder, or FTP site.

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 http://www.freedesktop.org.

[Note]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.

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 10.8. Directory Entry File Keys

Directory Entry Key

Description

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.


Editing Menus

SUSE Linux Enterprise uses the freedesktop.org menu specification. This specification uses the following files and directories:

Table 10.9. Menu File Locations

File

Description

/ets/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.

/ets/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.

/ets/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.