I’m having some difficulty editing openbox’s menus and I’m not sure if it’s something I’m doing/not doing or something openbox is setup for from the openSuSE repos. I have the proper menu.xml in ~/.config/openbox, but openbox doesn’t seem to be using it. It’s using some other oddball menu that’s pre-populated with the currently installed programs. What I’d like to do is use this same menu, but add on to it. I want to customize it just a tad. Is there any way to do this? Whenever I manually edit menu.xml or use obmenu, none of the changes take effect. Openbox just used the stock menu that ships with opensuse.
openbox generates its menus dynamically every time. It seems to messes up sometimes. Look at this snapshot of the menus in the same session within the space of two minutes. There is apparently a problem.
http://img204.imageshack.us/img204/3785/openboxmenu.th.png](http://img204.imageshack.us/img204/3785/openboxmenu.png)
Menus are mine - not openSUSE’s or anyone’s. I put my desktop files in /usr/local/share/applications, my directories in /usr/local/share/desktop-directories. My XDG_DATA_DIRS and XDG_CONFIG_DIRS look like this:
$ echo $XDG_DATA_DIRS
/usr/local/share:/usr/share
$ echo $XDG_CONFIG_DIRS
/usr/local/config/xdg:/etc/xdg
and my menu files are in /usr/local/config/xdg/menus:
# find /usr/local/config/xdg/menus -type f
/usr/local/config/xdg/menus/kde-information.menu
/usr/local/config/xdg/menus/lxde-applications.menu
/usr/local/config/xdg/menus/kde4-applications.menu
/usr/local/config/xdg/menus/applications-merged/kde-essential.menu
/usr/local/config/xdg/menus/applications-merged/kde-multimedia-music.menu
/usr/local/config/xdg/menus/kde-settings.menu
/usr/local/config/xdg/menus/xfce-applications.menu
/usr/local/config/xdg/menus/settings.menu
/usr/local/config/xdg/menus/xfce-applications.menu.old
/usr/local/config/xdg/menus/preferences.menu
/usr/local/config/xdg/menus/applications.menu
/usr/local/config/xdg/menus/kde-screensavers.menu
/usr/local/config/xdg/menus/gnomecc.menu
This is my ~/.config/openbox/menu.xml
<?xml version="1.0" encoding="UTF-8"?>
<openbox_menu xmlns="http://openbox.org/3.4/menu">
<menu id="applications-menu" label="Menu" execute="xdg-menu applications"/>
<menu id="settings-menu" label="Settings" execute="xdg-menu settings"/>
<menu id="apps-term-menu" label="Terminals">
<item label="Rxvt Unicode">
<action name="Execute">
<command>urxvt</command>
</action>
</item>
<item label="Gnome Terminal">
<action name="Execute">
<command>gnome-terminal --geometry=135x60+0-30</command>
<startupnotify>
<enabled>yes</enabled>
</startupnotify>
</action>
</item>
<item label="Xfce Terminal">
<action name="Execute">
<command>Terminal --geometry=152x60-0+0</command>
<startupnotify>
<enabled>yes</enabled>
</startupnotify>
</action>
</item>
<item label="Root Shell">
<action name="Execute">
<command>aterm -name rootshell -tr -tint red -fg white -fading 50 -e su -</command>
<startupnotify>
<enabled>yes</enabled>
</startupnotify>
</action>
</item>
<item label="Xterm">
<action name="Execute"><command>xterm</command></action>
</item>
</menu>
<menu id="root-menu" label="Openbox 3">
<separator label="Openbox"/>
**<menu id="applications-menu"/>**
<menu id="settings-menu"/>
<separator/>
<menu id="apps-term-menu"/>
<separator/>
<item label="Reconfigure">
<action name="Reconfigure" />
</item>
<item label="Exit">
<action name="Exit">
<prompt>yes</prompt>
</action>
</item>
<separator/>
<item label="Log Out">
<action name="SessionLogout">
<prompt>yes</prompt>
</action>
</item>
</menu>
</openbox_menu>
The entry applications-menu is relevant here. It reads applications-menu (I guess, in my case) in $XDG_CONFIG_DIRS, looks for apps in $XDG_DATA_DIRS and builds the menus according to the categories specified in the desktop files and present in the menu file.
But something goes wrong with the Administration submenu for me - I even renamed the directory file from Administration.directory to X_Administration.directory, but it didn’t help.
All of that information is really helpful, thanks. I still cannot get it to work. From what I understand, there’s a menu command that has openbox reference the pre-generated items (applications menu) and then there’s the ability to insert custom menus. Is this correct? If so, I still cannot get that to work. I’ve attached my menu.xml. From the example, you can see I don’t want a submenu for the programs, I just want a list of programs (konsole, chromium, transmission, file manager, etc…) that I can access just by right-clicking and accessing the menu.
<?xml version="1.0" encoding="utf-8"?>
<openbox_menu xmlns="http://openbox.org/3.4/menu">
<item label="Konsole">
<action name="Execute">
<execute>
konsole
</execute>
</action>
</item>
<menu id="None-22958" label="New Menu">
<item label="New Item">
<action name="Execute">
<execute>
command
</execute>
</action>
</item>
</menu>
<menu execute="openbox-pipemenu" id="apps-menu" label="Applications"/>
<menu id="ob-menu" label="Openbox Preferences">
<item label="Openbox Configuration Manager">
<action name="Execute">
<command>
obconf
</command>
<startupnotify>
<enabled>
yes
</enabled>
</startupnotify>
</action>
</item>
<item label="Reconfigure Openbox">
<action name="Reconfigure"/>
</item>
</menu>
<menu id="root-menu" label="Openbox 3">
<separator label="Openbox 3"/>
<menu id="apps-menu"/>
<separator/>
<menu id="ob-menu"/>
<separator/>
<item label="Log Out">
<action name="Exit">
<prompt>
yes
</prompt>
</action>
</item>
</menu>
</openbox_menu>
Try that one and add the programs you like (I put konsole and chromium):
<?xml version="1.0" encoding="utf-8"?>
<openbox_menu xmlns="http://openbox.org/3.4/menu">
<!-- menu execute="openbox-pipemenu" id="apps-menu" label="Applications"/ -->
<menu id="ob-menu" label="Openbox Preferences">
<item label="Openbox Configuration Manager">
<action name="Execute">
<command>
obconf
</command>
<startupnotify>
<enabled>
yes
</enabled>
</startupnotify>
</action>
</item>
<item label="Reconfigure Openbox">
<action name="Reconfigure"/>
</item>
</menu>
<menu id="root-menu" label="Openbox 3">
<separator label="Openbox 3"/>
<menu id="apps-menu"/>
<separator/>
<menu id="ob-menu"/>
<separator/>
<item label="Log Out">
<action name="Exit">
<prompt>
yes
</prompt>
</action>
</item>
<item label="Konsole">
<action name="Execute">
<command>konsole</command>
<startupnotify>
<enabled>yes</enabled>
</startupnotify>
</action>
</item>
<item label="chromium">
<action name="Execute">
<command>chromium</command>
<startupnotify>
<enabled>yes</enabled>
</startupnotify>
</action>
</item>
</menu>
</openbox_menu>
You have to comment out this:
<!-- menu execute="openbox-pipemenu" id="apps-menu" label="Applications"/ -->
to prevent openbox from building menus and creating entries for all the apps found in $XDG_DATA_DIRS
On 12/21/2011 06:06 AM, DupermanDave wrote:
>
> All of that information is really helpful, thanks. I still cannot get it
> to work. From what I understand, there’s a menu command that has openbox
> reference the pre-generated items (applications menu) and then there’s
> the ability to insert custom menus. Is this correct? If so, I still
> cannot get that to work. I’ve attached my menu.xml. From the example,
> you can see I don’t want a submenu for the programs, I just want a list
> of programs (konsole, chromium, transmission, file manager, etc…) that
> I can access just by right-clicking and accessing the menu.
>
>
> Code:
> --------------------
> <?xml version=“1.0” encoding=“utf-8”?>
> <openbox_menu xmlns=“http://openbox.org/3.4/menu”>
>
> <item label=“Konsole”>
> <action name=“Execute”>
> <execute>
> konsole
> </execute>
> </action>
> </item>
>
> <menu id=“None-22958” label=“New Menu”>
> <item label=“New Item”>
> <action name=“Execute”>
> <execute>
> command
> </execute>
> </action>
> </item>
> </menu>
> <menu execute=“openbox-pipemenu” id=“apps-menu” label=“Applications”/>
> <menu id=“ob-menu” label=“Openbox Preferences”>
> <item label=“Openbox Configuration Manager”>
> <action name=“Execute”>
> <command>
> obconf
> </command>
> <startupnotify>
> <enabled>
> yes
> </enabled>
> </startupnotify>
> </action>
> </item>
> <item label=“Reconfigure Openbox”>
> <action name=“Reconfigure”/>
> </item>
> </menu>
> <menu id=“root-menu” label=“Openbox 3”>
> <separator label=“Openbox 3”/>
> <menu id=“apps-menu”/>
> <separator/>
> <menu id=“ob-menu”/>
> <separator/>
> <item label=“Log Out”>
> <action name=“Exit”>
> <prompt>
> yes
> </prompt>
> </action>
> </item>
> </menu>
> </openbox_menu>
>
> --------------------
>
>
Your problem is where you are inserting your own menu items. They should
be inside the “root-menu” section:
…]
<menu id=“root-menu” label=“Openbox 3”>
<separator label=“Openbox 3” />
<item label=“UXTerm”>
<action name=“Execute”>
<command>uxterm</command>
</action>
</item>
<menu id=“apps-menu” />
…]
Similarly, you declare a submenu inside there and define the submenu
above; just follow the default menu structure.
I seem to remember getting tripped up on this, too. I think the xml
definition has changed or something.