You are not logged in.

#1 2018-07-09 15:48:13

Middle Office
Registered: 2015-09-29
Posts: 1,661

source submenu.xml? (SOLVED)

In openbox I have an xml sub-menu generated by script (written to disk to xml file), what would be the correct syntax to add that to openbox root menu as submenu?
Pretty sure it's NOT:

<menu execute="cat ~/bin/misc.xml" id="pipeMisc_cached" label="pipe"/>

While it does work it is fugly.

And this fails (empty output)

<menu id="id_test" label="test">

Edit: Ok, this appears to fail by moving it up or down the menu.xml (and from unknown reasons)

<menu source="~/bin/misc.xml" id="pipeMisc_cached" label="pipe"/>

edit: Ok, it just occurred to me that my submenu.xml would need some sort of different than 'pipemenu' type of xml, will keep the cat/pipemenu syntax for easier switching back to dynamic menu if the need arises.

Last edited by brontosaurusrex (2018-07-09 19:04:37)


#2 2018-07-10 01:48:04

From: Nagoya, Japan
Registered: 2015-09-09
Posts: 4,929

Re: source submenu.xml? (SOLVED)

I remember running into mysterious issues with submenus in the past. The rule seems to be that the submenu must be defined before it is called. Either in a separate file called in rc.xml before menu.xml, or in menu.xml before the main menu is defined. Once a submenu is defined and has an id, you don't need a <file> element though, just

<menu id="id_test"></menu>

(The label can be defined in the submenu definition.)

You don't even need to put such a menu in the main menu at all, just attach it to a keybind in rc.xml:

    <keybind key="S-C-W-i">
      <action name="ShowMenu">

And possibly call it via xdotool.

EDIT Using cat on some xml file pipemenu style seems to be quite popular and has the advantage it will pick up dynamic changes, but is still faster than generating the file on-demand every time. If your file is only regenerated occasionally, though, you could just add it to rc.xml in the menu section, and reconfigure openbox as needed.

Last edited by johnraff (2018-07-10 02:01:33)

( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.


#3 2018-07-10 07:33:13

Middle Office
Registered: 2015-09-29
Posts: 1,661

Re: source submenu.xml? (SOLVED)

Thanks for this, if I understand correctly the non-cat way would need 'openbox --reconfigure' to rebuild?


#4 2018-07-10 11:06:32

Registered: 2015-09-29
Posts: 3,419

Re: source submenu.xml? (SOLVED)

^ yes.
and btw, it can be as simple as this:

    <!-- 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
         default menu file (or custom one in $HOME/.config/openbox/) -->

(excerpt from rc.xml)

otherwise, use a pipemenu.

Last edited by ohnonot (2018-07-10 11:10:15)


Board footer

Powered by FluxBB