JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris 11.1 Desktop Administrator's Guide     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

1.  Administering the Oracle Solaris Desktop

2.  Managing User Preferences With GConf

3.  Customizing Menus

Menus Overview

Working With Menu Definition Files

Working With Directory Entry Files

Working With Desktop Entry Files

Editing Menus

Adding and Modifying System Menus

How to Add a Menu

How to Add an Item to a Menu

How to Edit the Properties of a Menu

How to Edit a Menu Item

How to Delete an Item From a Menu

Creating and Modifying User Menus

Merging Menus

Merging User and System Menus

4.  Installing Themes

5.  Customizing Fonts

6.  Working With MIME Types

7.  Managing Screensavers

8.  Managing Sessions

9.  Overview of the Yelp Help Browser

10.  Improving the Performance of the Oracle Solaris Desktop System

11.  Disabling Features in the Oracle Solaris Desktop System

12.  Working With the X Window System

A.  Hidden Directories

Glossary

Index

Working With Menu Definition Files

Menu files define the hierarchy of menus that are used in the Oracle Solaris Desktop menu bar. By modifying these files, you can customize menus for all users or for a single user depending on the location of the applications.menu file that you modify.

Menu files must reside in the $XDG_CONFIG_DIRS/menus/applications.menu directory. To work with menu files, you must set the $XDG_CONFIG_DIRS environment variable, defined in the XDG base directory specification.

To resolve the location of the applications.menu file, the system searches the default path in the following order:

  1. Searches each directory in the $XDG_CONFIG_HOME path to find the menus/applications.menu file. If the $XDG_CONFIG_HOME environment variable is not set, the search defaults to the ~/.config/ directory.

  2. Searches each directory in the $XDG_CONFIG_DIRS path to find the menus/applications.menu file. If the $XDG_CONFIG_DIRS environment variable is not set, the search defaults to the /etc/xdg/ directory.

  3. Uses the first applications.menu file found.

The following example shows a sample .menu file:

Example 3-1 Example of a .menu File

<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
 "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
<Menu>
  <Name>Applications</Name>
  <Directory>Applications.directory</Directory>

  <!-- Read standard .directory and .desktop file locations -->
  <DefaultAppDirs/>
  <DefaultDirectoryDirs/>

  <!-- Accessories submenu -->
  <Menu>
    <Name>Accessories</Name>
    <Directory>Accessories.directory</Directory>
    <Include>
      <And>
        <Category>Utility</Category>
        <Not>
        <Category>System</Category>
        </Not>
      </And>
    </Include>
  </Menu> <!-- End Accessories -->

  <!-- possibly more submenus -->

</Menu> <!-- End Applications -->

In this example, the top level menu is named Applications, which is specified using the <Name> element. The Applications menu contains a single submenu, but several submenus are allowed. Each submenu can also have an <Include> element to perform a filter on the set of available desktop entries using matching rules.

For example, the <Category> element is a basic matching rule that selects a desktop entry file only if the Categories key contains the content of the <Category> element. In the example, the Accessories menu will include a desktop entry only if the menu contains the word “Utility” but not “System” in the Categories key. For more information about the Categories key, see Working With Desktop Entry Files.

The following table describes some of the elements in .menu files.

Table 3-1 Menu Definition File Elements

Element
Description
Menu
Root element that may contain nested <Menu> elements. The nested elements define submenus. The way these elements are nested determines the menu structure.
Name
Specifies the name of the menu. Every <Menu> element must contain a <Name> element.
Directory
Specifies the name of the directory entry file that specifies the name, comment, and icon for the menu. If this element is not specified, then the <Name> element has to be used to display the menu name.

By default, .directory files are searched in the $XDG_DATA_DIRS/desktop-directories/ directory as defined in the XDG menu specification.

DefaultAppDirs
An instruction that indicates that all the available desktop entries from the $XDG_DATA_DIRS/applications/ directory should be scanned. If this instruction is not included, then these locations are not scanned for desktop entries.
DefaultDirectoryDirs
An instruction that indicates that all the available directory entries from the $XDG_DATA_DIRS/desktop-directories/ directory should be scanned. If the instruction is not included, then these locations are not scanned for directory entries.
Include
Contains a list of matching rules by which the contents of a menu are generated. Might include the <Filename>, <Category>, <And>, <Or>, <Not>, or <All> matching rules.
Exclude
The opposite of the <Include> element. If any desktop entries are matched with this element, the entries are excluded from the previous set of included elements. For this reason, this element must appear after the <Include> element.
Filename
A matching rule that selects a desktop entry when the Desktop File-Id matches the contents of the <Filename> element.
Category
A matching rule that selects a desktop entry when the Categories key matches the contents of the <Category> element.
And
A matching rule that selects a desktop entry when the entry is selected by all nested matching rules in the <And> element.
Or
A matching rule that selects a desktop entry when the entry is selected by any nested matching rules in the <Or> element.
Not
A matching rule that does not select a desktop entry when the entry is selected by any nested matching rules in the <Not> element.
All
A matching rule that selects all desktop entries.

For a detailed description of the elements in the .menu files, see the XDG menu specification.