Help:Menus

From Openbox

Revision as of 00:51, 5 June 2007 by Mikachu (Talk | contribs)

Jump to: navigation, search

Menus are not read out of the rc.xml configuration file, but rather out of files specified in the rc.xml. In the default configuration, the menu.xml file is used for all of the menus.

The menu.xml file is located in ~/.config/openbox/menu.xml or in the system-wide /etc/xdg/openbox/menu.xml.

Contents

Static menus

Syntax

A menu file must be entirely enclosed within <openbox_menu> tags, such as:

<openbox_menu>
  ...menu stuff here...
</openbox_menu>

Inside these tags, menus are specified as follows:

<menu id="ID" label="TITLE">
  <!-- this is a menu item, such as a program -->
  <item label="LABEL">
    ACTIONS
  </item>

  <!-- this is a menu header -->
  <separator label="La la" />

  <!-- this links to a sub menu -->
  <menu id="ID" />

  <!-- this is a small line separator -->
  <separator />

  <!-- this also links to a sub menu, which is defined inline -->
  <menu id="ID" label="TITLE" />
    <item label="LABEL">
      ACTIONS
    </item>
  </menu>

  <separator />

  <item label="LABEL">
    ACTIONS
  </item>
</menu>

The syntax example above shows how to put entries into a menu (with <item>), and two methods to add submenus to a menu (with <menu>). It also shows how to put menu headers and separators (with <separator>) into the menu to group items together without submenus.

ID

Each menu must be given an ID which is a unique identifier for the menu. This ID is used to refer to the menu in a ShowMenu action.

TITLE

The TITLE of the menu is shown when you link to the menu as a submenu. The TITLE will appear in its parent menu.

LABEL

The LABEL in an <item> tag is the visible name of the menu item. In the <separator> tag, the LABEL transforms the separator from a small horizontal line to a menu header with the given text in it.

ACTIONS

The ACTIONS are 0 or more actions which are executed in order when you select the menu item. Typically, in menus, these are Execute actions, which run commands.

Pipe menus

Pipe menus are dynamic menus, built on-the-fly from scripts. These are referred to as "Pipe menus" since the script's output is piped back to Openbox and used for the menu. There are a number of pipe menus written by various people available through the Pipe menus page.

A pipe menu can be created by placing the following into a menu file, such as menu.xml:

<menu id="ID" label="TITLE" execute="COMMAND" />

Thereafter the pipe menu can be referenced just like any other menu.

COMMAND

The COMMAND is the script to be executed, which will create the pipe menu for Openbox. The output from this command is parsed and turned into the menu. The output from the script should be a menu, something like:

<openbox_pipe_menu>
  <item label="LABEL">
    ACTIONS
  </item>
</openbox_pipe_menu>
Personal tools