Help:Menus

From Openbox

Revision as of 17:07, 26 October 2007 by 71.130.204.199 (Talk)

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>

The Debian menu

Source installs or prepackaged .debs from openbox.org will not configure your setup to show the Debian menu. There are a few simple steps to get it working.

If you have already installed openbox with a working Debian menu

Add this line to your ~/.config/openbox/menu.xml:

 <menu id="Debian" />

You should place the line where you would like it to appear in the root menu. Location matters!

Add these lines to your ~/.config/openbox/rc.xml between the <menu> and </menu> tags:

   <file>/var/lib/openbox/debian-menu.xml</file>
   <file>debian-menu.xml</file>

The second line allows you to copy the debian-menu.xml file from /var/lib/openbox to your local ~/.config/openbox, where it becomes static (update-menus will not affect it). You can then edit it by hand and your changes will be permanent.

That's all you should have to do, though it's a good idea to run update-menus as root every now and then if you don't have a cron job assigned. It refreshes the list of currently installed apps.

Then choose "reconfigure" on your root menu and you should get a Debian menu.

If you haven't had a working debian menu

This is a little trickier, but no big deal. First do all the steps listed above.

Then there's this little humdinger: you'll need to get a copy of an executable script named "openbox" and copy it to /etc/menu-methods. (The script actually creates the Debian menu when you run "update-menus.")

The easiest way is to install an official debian openbox. This will normally ensure that you have all the packages required to create and use the Debian menu.

After installation you can copy that file, then let it get uninstalled by dpkg when you put in the openbox.org deb file. If you're installing from source, you can just "aptitude remove" the official deb and proceed as normal.

If you don't want to do that, download an official .deb and type the command dpkg-deb -x <officialopenbox.deb> <directory you want it in, usually . >

This will unpack a mini-filesystem that includes the script you need in localdir/etc/menu-methods. Copy that script to the real /etc/menu-methods and issue the command "update-menus" as root.

If you did not install an official openbox .deb, you should make sure you have the following packages installed:

  • menu
  • menu-xdg

As above, choose reconfigure from your root menu and at that point, you should have a brand new Debian menu.

Personal tools