Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

Editing User Menus and Menu Merging

You can use the following GNOME Desktop applications to edit menus for users:

  • GNOME Menu Editor

A simple menu editor is available for users to edit their menus. For more information, see Working With Menus in the GNOME User Guide. Alternatively, you can manually create and edit a user menu file.

To manually create a custom menu for a user, the $XDG_CONFIG_HOME/menus/applications.menu must exist. In the case that $XDG_CONFIG_HOME is not set, the default ~/.config directory is used. Since this is the first location that is searched for the applications.menu file, it takes precedence over all other menu files.

User menus can contain all the elements described in the section called “Menu Definition Files”. For a complete list of the elements allowed, see the XDG menu specification.

Since user menu files take precedence over the system menu file, it will completely replace the system menu unless it explicitly merges the system menu. Information on menu merging is available in the following subsections.

Merging the System Menu

Often, a user only wants to add or delete menu items in addition to the standard system menu. To support single changes like these, it is recommended that you use the <MergeFile> element with the attribute type="parent" within the user's applications.menu file.

The <MergeFile> element allows a menu to be merged with the contents of the user's menu file. When you specify the attribute type="parent", then the contents of the <MergeFile> element are ignored and the next applications.menu file in the $XDG_CONFIG_DIRS/menus directory is used for merging.

Older Specifications

Older specifications did not include the type attribute and simply required the location of the menu file to be merged as the content of the <MergeFile> element. As a result, you may still see a location specified in the contents of <MergeFile>, even when type="parent".

The merging is performed as follows:

  • The children of the root <Menu> element in the merged menu file[3] are substituted for the <MergeFile> element in the base menu file.

  • All child <Menu> elements with the same name are consolidated into a single <Menu> element. This is by done appending all child elements of each <Menu> element with the same name into the last occurrence of the menu element.

Example 2.3, “Merging the System Menu” shows an example of a user menu file explicitly merging the system menu file.

Example 2.3. Merging the System Menu

<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
 "https://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd">

<Menu>
  <Name>Applications</Name>
  <MergeFile type="parent">/etc/xdg/menus/applications.menu</MergeFile>
  <Menu>
    <Name>Accessibility</Name>
    <Exclude>
      <Filename>dasher.desktop</Filename>
    </Exclude>
  </Menu>
</Menu>

Merging Arbitrary Menus

Arbitrary menu files can be merged in much the same way as system menus. The difference is that the type attribute must be set to path or must be excluded from the <MergeFile> element in order to do this type of merge.

The merge is performed in the same way except that the location of the merged menu file is specified in the contents of the <MergeFile> element.


Previous
Editing System Menus
GNOME 2.14 Desktop System Administration Guide Next
Installing Themes

 
 
  Published under the terms of the GNU General Public License Design by Interspire