SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2009-11-08 10:08:32

david
Member
Registered: 2009-01-06
Posts: 30
Website

How to set up a dynamic XDG menu for Openbox

I blogged about this but as usual I was quite scarce on details.


http://github.com/mulberry/obtools/tree … obxdgroot/

or

http://david.chalkskeletons.com/files/o … 0.1.tar.gz

You will need to have python-gmenu installed for this to work.

The package includes two scripts:

xdgopenboxmenu.sh

This script just needs to be run *once* it downloads the openbox xdg-pipemenu and copies it to ~/bin, it then backs up your menu.xml and writes a new menu.xml:

<?xml version="1.0" encoding="utf-8"?>
<openbox_menu>
<menu execute="cat ~/.config/openbox/rootmenu.xml" id="root-menu" label=""/>
</openbox_menu>

The pipemenu is run to create a new file "rootmenu.xml" in ~./config/openbox. This menu is referenced as a pipe menu simply by cat'ting it, serving as a poor man's cached menu, removing the usual problem of writing a pipe menu on demand (it's quick). That is what the script does. (Id' probably back up your menu yourself first)

genmenu
So far all that has happened is that we have created a static xdg menu that acts as your root openbox menu. Next we need to have it update. There are lots of ways to do this, I've included two examples. genmenu is a wrapper for inotifywait (included in inotify-tools), it watches your application folders and when it spots changes (menu edits, added removed applications etc) it writes a new menu. The alternative way is to use fsniper and use the configuration that is included in xdgopenboxmenu.sh. Either of these can be added to autostart.sh or .xinitrc (or somewhere)

Alternatively you can manually update your menu when you have made changes by running the script:

xdg-menu > ~/.config/openbox/rootmenu_tmp.xml && mv -f ~/.config/openbox/rootmenu_tmp.xml ~/.config/openbox/rootmenu.xml

This goes around the houses a bit by writing the script and them moving it, it just tries to reduce the time when the rootmenu.xml is unavailable ( a very, very short time anyway).

You will probably need to install an XDG menu editor such as Alacarte to organise your menus, you might need to create some extra .desktop files for programs that do not have them. After that it is plain sailing.

There are lots of way to do similar things, the important things are the using a pre-created menu to reference, over generating as a normal pipemenu and somehow keeping your menu uptodate...

I don't know anyone except me who is using this so i'd appreciate any feedback etc.

(yeah this could maybe have gone in another topic about pipemenus or some other menu related topic)

----------------------------------------------------------

Edit: XDG menus are the standard menus that kde/xfce/rox/gnome/etc use you can read more about them here:

http://standards.freedesktop.org/menu-s … troduction

Last edited by david (2009-11-08 21:21:53)

Offline

Be excellent to each other!

#2 2009-11-08 17:35:20

jobester
#! CrunchBanger
Registered: 2008-11-29
Posts: 151

Re: How to set up a dynamic XDG menu for Openbox

Looks interesting and read the blog post but still a bit lost, don't know what an XDG menu is.  What is this used for?

Last edited by jobester (2009-11-08 17:36:54)

Offline

#3 2009-12-11 07:23:16

wattrone
New Member
Registered: 2009-12-09
Posts: 3

Re: How to set up a dynamic XDG menu for Openbox

hello
It really nice information thread it is help me lot. I found many interesting thing about XDG openbox.
Thanks

Offline

#4 2010-04-08 03:15:16

jdcFuimus
Member
Registered: 2010-04-01
Posts: 12

Re: How to set up a dynamic XDG menu for Openbox

Nice one david - it took me a while to figure this out. I was irritated that it destroyed my menu.xml, but oh well should have looked at it better.

So here's what I did.

1. I copied xdg-menu to /usr/bin/crunchbang and renamed it to obpipemenu-xdg-menu

 sudo cp xdg-menu /usr/bin/crunchbang/obpipemenu-xdg-menu

2. I reset my menu.xml back to normal and added the following lines to that.
- right above the root-menu at that top I added:

    <menu execute="obpipemenu-xdg-menu" id="xdg-menu" label="Applications" />
    <menu id="root-menu" label="Openbox 3">

3. I placed the pipemenu where I wanted

     <separator label="Applications" />
    <menu id="xdg-menu" />    

here's a screenshot
x5tkpw.png


Honestly, I think this should be a default with !# wink Statler Maybe

Last edited by jdcFuimus (2010-04-08 03:15:47)

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo