[openbox] how to integrate other menu files into menu.xml/rc.xml/root-menu?

R. Mattes rm at mh-freiburg.de
Wed Sep 4 04:52:37 EDT 2013


On Wed, 04 Sep 2013 11:00:03 +0300, turkuting wrote
> hello all,
> i don't usually write here, i hope i'm not interrupting any ongoing
> topic or sth.
>
> i am really asking for advice with this thing.
> in rc.xml it says:
>
>    <menu>
>      <!-- You can specify more than one menu file in here and they
> are all loaded,        just don't make menu ids clash or, well,
>  it'll be kind of pointless -->     <!-- default menu file (or
> custom one in $HOME/.config/openbox/) -->     <!-- system menu files
> on Debian systems     <file>/var/lib/openbox/debian-menu.xml</file>
>    <file>debian-menu.xml</file> -->     <file>menu.xml</file>    
<file>/home/me/.config/openbox/bin/appmenu.xml</file>
> ...
> </menu>
>
> i remember this has worked in the past with the debian menu, however
> i never tried with a different file. but now, on a non-debian
> install (archlinux) i'd like to achieve that but find it impossible?
> i think i tried every possible syntax variation, i even tried to
> reproduce the syntax of the debian-menu.xml (every entry starts with
> /Debian, i replaced that with /amenu, since this was the id i had
> given that menu).
>
> the ob wiki is clear and concise:
>   <!-- this links to a sub menu -->
>    <menu id="ID" />
>
> i added lines like this to menu.xml:
> 	<menu id="link-103844"/>
> 	<menu id="appmenu" label="Appmenu" />
> 	<menu id="/amenu" />
>
> either the menu does not show up at all or it's just empty, no submenus.
> i don't get errors, also ~/.cache/openbox/openbox.log does not show
> anything helpful.
>
> i even tried adding the submenu with obmenu, but the resulting
> syntax is pretty much the same as what i did manually.

There are several steps needed:

1. you need to define a menu - something like this:

   <menu id="multimedia-menu" label="Multimedia">    [1]
    <item label="Q-JAckControl">                     [2]
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>JackControl</name>
        </startupnotify>
        <command>qjackctl</command>
      </action>
    </item>
    .....
   </menu>

Note that to define a menu you need to give a menu element[1] containing
item[2] elements.
Once the menu is defined, you can use it as a submenu in other menus:

  <menu id="root-menu" label="Openbox 3">
   ....
     <menu id="multimedia-menu"/>
   ....
  </menu>

Note that here you only need to give the menu's id.
@developers: (ab)using  one tag for both definition and inclusion
of a menu seems like a major design flaw. Something like
<include-menu id=".."/>  would have been much clearer ...
  Sidenote: of course, this is all reinvent-the-wheel-this-time-square.
  XML does have an in-build mechanism to do the same - it's called XInclude.

  <xi:include href="b.xml/menu[@id='my-menu']"/>


Ok, the one part that's missing: if you put you menu into a separate
file, you need to tell OB to read this file - that's what the

     <file>/path/to/my/menu.xml</file>

in rc.xml is for.

HTH Ralf Mattes

--
R. Mattes -
Hochschule fuer Musik Freiburg
rm at inm.mh-freiburg.de



More information about the openbox mailing list