Obmenu-Generator, how to get it running on any linux

Basically I am reproducing a very good article of instructions before it vanishes.

03262019  revised for debian/mint/ubuntu/devuan/antix/mx users see below:

[edit] Today Feb 15rh I am reposting this article and made some additions and corrections as the instructions may not work in all installations as I have found out.  With this correction it works in all installations we have covered.  Today we are adding Antix-linux to the list.

Hopefully the author will not mind for this no-profit reproduction.  The original, today, can be found on lxlinux.com/obmenu-generatorObmenu-generator works so well and can be edited to the maximum possible way that an Openbox Menu system can deliver.OPENBOX HOME

   Openbox Dynamical Root Menu

For those Openbox users who want a dynamical Root Menu, that is, a right click menu that automatically picks up newly installed Linux apps, I recommend Daniel Trizen’s Obmenu-generator.    Obmenu-generator, should not be confused with obmenugen, which is different and much less feature endowed. Obmenu-generator is a simple, lightweight (367 KB), easily configurable Perl script that generates a valid, full, dynamical Openbox xml-menu based upon the information present in *.desktop application files. It has few dependencies and is very fast and accurate. Most pure Linux apps automatically install a desktop file, and such apps will generally appear in their stipulated categories default in most menus. Wine, Java and apps created locally by special scripts, generally do not automatically appear in menus after installation. To appear in a menu, they require the installer, himself, create an application desktop file. See Openbox Guide – Desktop Files . Obmenu is no exception to these rules. An example of an (edited) Obmenu-generated menu is below-right.

At this time the only Debian file for Obmenu-generator known to me is one in the Sparky Linux repository. See the Addendum below for using it to install Obmenu-generator. Otherwise, one can install it using Trizen’s copy from the github link identified above. First make sure that build-essential, cpanminus and git are installed: (Devuan/Debian based command) sudo apt-get install build-essential cpanminus git (on Arch, Artix, Obarun,..)  sudo pacman -S build-essential cpanminus git

Then, apply the following sequence of terminal commands:

    git clone git://github.com/trizen/obmenu-generator
    sudo cp obmenu-generator/obmenu-generator /usr/bin
    sudo cp -r obmenu-generator/schema.pl ~/.config/obmenu-generator
    sudo cpanm Linux::DesktopFiles
    sudo cpanm Data::Dump
    sudo chmod 777 /usr/bin/obmenu-generator

To set a dynamical version of the Root Menu, put the following in the terminal (leaving out “-i” if you want an icon-less menu):

    obmenu-generator -p -i

Obmenu-generator works by creating an upfront file, ~/.config/obmenu-generator/schema.pl, to replace ~/.config/openbox/menu.xml as the file for editing the menu. I’ve tried distros in the past that created a schema file to make a dynamic openbox root menu, but found them lacking simplicity and being overly restrictive in what kind of static entries could be made. Obmenu-generator is different in both instances. Configuring schema.pl, including adding new dynamical categories, is for the most part very easy. Everything possible with a static root menu is still possible with the Obmenu. What follows is a precise description for editing each of the sections pictured in the enhanced Obmenu pictured on the right.

[additional information 15/2/2017]:  If     obmenu-generator -p -i does not work, but     obmenu-generator -p  does produce a dynamic menu without icons then there is a package missing.  Usually this seems to be true in all Debian based distros.  The missing package relates perl to GTK2, in debian repositories is called libgtk2-perl  (Perl interface to the 2.x series of the Gimp Toolkit library), so in other distributions you may find its equivalent.  In arch based distros and void this did not happen. So,

sudo apt-get install libgtk2-perl 
obmenu-generator -p -i

and you should be happy editing your schema.pl file in ~/.config/obmenu-generator/ and creating a custom menu with icons of your own.


Default Categories

The crux of the obmenu-generator menu are 11 (plus 5 special unactivated categories not pictured) pre-programmed categories. They are completely dynamic in that their contents instantly change to reflect the addition of a new app (*.desktop file). So there is nothing configurable here, or needing to be configured. The lists appear to be very accurate in their reflection of the categories listed for an app and the layout of apps in the lists is very friendly – alphabetical regardless of case. In the past I’ve had menus list every app on the computer plus everything under the kitchen sink in the “other” category. Notice that the menu picture here does not even show the “other” category, which is included in the default categories, because none of the apps installed lists category=”other”, and the other 10 listed categories are sufficient to include everything else. In general, a category does not appear on the menu if there are no installed apps listed in that category. New categories can be created by simply adding an appropriate line in the schema file. For example, to add the Wine category, we simply added the following line at the end of the categories section of schema.pl:

{cat => ['wine',     'Wine',    '/usr/share/icons/Black-Diamond/scalable/apps/wine-doors.png']}

Now a regular static Openbox Root Menu can be configured to include a catch-all “Applications” category, which in turn consists of a dynamical sub-category list. See any of the following: Lxlinux – Menu, Openbox Menu, After Openbox for details. Not much different from the situation here. However, there is something appealing, not to mention slightly faster, about just right clicking the desktop and having a complete set of dynamical categories open-up to slide the tool-tip through just once, instead of having to do it twice, to reach an app launch point.

Adding Items or Pipemenus

Adding a new item (application) or a new pipemenu requires a one line edit to supply information for 3 fields: exec, name, icon . The following examples illustrate the syntax and nature of the two types of entries:

{item => ['pmrp-vlc', 'Radio Player', 'radio']},
 {pipe => ['python /opt/menu/dir-menu.py', 'Places-Comp', '/usr/share/icons/directory.png']}, .

If a generic name is given for an icon, the program will try to match it with an icon from the icon theme chosen in lxappearance. Otherwise, giving the path to a specific icon will choose that icon.

Adding Special User Categories

If there are not many applications in the category, then it is easiest to just make an item entry for each app between the category introduction and exit tags. For the scrot category in the above menu, it looks like the following:

{begin_cat => ['Scrot -q 90', '/usr/share/icons/scshoot.png']},
 {item => ['scrot -q 90 -e "mirage $f"', 'Now', '/usr/share/icons/scrot0.png']},
 {item => ['scrot -q 90 -d 15 -e "mirage $f"', 'In 15 Seconds', '/usr/share/icons/scrot-15.png']},
 {item => ['scrot -q 90 -s -e "mirage $f"', 'Area (drag mouse)', '/usr/share/icons/scrot-area.png']},
 {item => ['scrot -q 90 -u -e "mirage $f"', 'Window (click win)', '/usr/share/icons/scrot-wndw.png']},
 {item => ['scrot -q 90 -m -e "mirage $f"', 'Multi-Monitor', '/usr/share/icons/scrot-mm.png']},
 {end_cat => undef},

Adding Submenus

It happens that sometimes a user has a long special submenu (*.xml file) all scribed out. Can it be added to the obmenu-generator menu without re-scribing it to fit the format described in the previous section? The answer is “yes”, which is the main reason that I now so heartedly embrace the obmenu-generator approach. I have several such menus which can be added to the classical static Openbox Root Menu with one line, and wanted something similar here. The recipe that I use follows.

Among Openboxes features is the ability to creat keybindings for any menu that follows the freedesktop standard. All that is required is making 2 simple edits in rc.xml for each menu. For example, to set up the Bash Menu (~/.config/openbox/bash.xml), which at the moment has over 40 entries and only gets bigger, I added to the menu section of ~/.config/openbox/rc.xml the following line:

<file>/home/me/.config/openbox/bash.xml</file> ,

and to the section <!– Keybindings for running applications –> of rc.xml, I added the following:

<keybind key="C-A-b">
 <action name="ShowMenu">
 </keybind> .

We can now launch the Bash Menu by pressing the key combination: Ctrl+Alt+b. For more information and discussion about menu key bindings in Openbox, see Openbox Menu.

xdotool key “ctrl+alt+b” &


The small very useful linux tool, xdotool, can be used to put Bash Menu on the Root Menu. If not already installed, then do sudo apt-get install xdotool . Copy and paste the small bash script on the left to a text file, name it bash-menu and save it in /usr/local/bin (can be saved anywhere on-the-path). Be sure bash-menu is executable and add it to schema.pl as an item:

{item => [‘bash-menu’, ‘Bash Menu’, ‘/usr/share/icons/bash.png’]}, .

Openbox Config Submenu

End of story. Bash Menu is now on the menu and left-clicking it will launch a new menu with the skeletons of 40+ terminal commands, any one of which will print on an open terminal when clicked. If interested, a copy of bash.xml can be downloaded from this website: wget http://lxlinux.com/bash.xml .

Obgenmenu (Openbox Config)

Openbox Config is a special category built into the exec file, /usr/bin/Obmenu-generator. The items in it can be edited by editing Obmenu-generator. A slightly edited version, which is what you get if you download obmenu-generator from this site (wget http://lxlinux.com/obmenu-generator), is pictured on the right. Here is where the user chooses the nature of the general menu and can launch the main editing files. My addition was to add links to additional desktop configuration tools, so that all the main desktop editing tools were together in the same category.

Since the main point of Obmenu-generator is to create a dynamical menu and that is done with the terminal command given above, I’m not sure what the point is of the “Generate…” section. To go back to a static menu, the user needs only to replace the menu.xml generated by Obmenu-generator by any menu.xml constructed for a static root menu.


Obmenu-generator is now in the Sparky Linux Repository, which has a large number of useful special tools. The Sparky Linux Repository can be added to your sources directory by creating a sparky.list file:

sudo geany /etc/apt/sources.list.d/sparky.list .

Type the following into sparky.list:

## sparky
deb http://sparkylinux.org/repo testing main .

Save the file and leave the editor. Update package list, install the public key via the package manager and install obmenu-generator using apt-get (or synaptic or pacman if in an arch based distro):

sudo apt-get update
sudo apt-get install sparky-keyring
sudo apt-get update
sudo apt-get install obmenu-generator .

The new “Root Menu” will probably be the Obmenu-generator static one, so bring it up and click “Advanced Settings>Obmenu-Generator>Generate a pipe menu …” to get a dynamical one. The original static root menu is saved as ~/.config/openbox/menu.xml.ba . Configuring the new dynamical menu is done in ~/.config/obmenu-generator/schema.pl as described above. In order to eliminate potential future update problems, you may want to inactivate the Sparky repo after installing obmenu-generator, if your system is not based upon Debian Testing.

You can download the complete Sparky Linux Repository (58.4 MB) with:

git clone git://git.code.sf.net/p/sparkylinux/code sparkylinux-code .

Installation of Obmenu-generator can be then also achieved directly from the files in the obmenu-generator folder in that download.


Again, thanks to the author at LXLINUX and Daniel Trizen for this wonderful tool


From a mint forum where this page is used to install obmenu-generator the following problem and solution appears.  As setups may vary from distribution to distribution I welcome this and any other work around to any problems that may appear:

[SOLVED] Openbox | Cannot get obmenu-generator working

Post by TopDownTom » Thu Sep 27, 2018 8:32 am

Hello all,

I am running Mint19 with XFCE, using Openbox as my window manager.

I am trying to get obmenu-generator running but I cannot seem to figure out what’s missing. Below I will list all steps followed, and hopefully all pertinent outputs. If you need others, please let me know. *Between each of these steps, and multiple times otherwise, I ran openbox –reconfigure && openbox –restart. I have even rebooted a few times, but I cannot enact the change I seek*
1.) I followed this page. When it prompts to run

obmenu-generator -p -i

this is my output:

mkdir /home/tom/.config/obmenu-generator: File exists at /usr/bin/obmenu-generator line 194.

But then nothing happens. I even tried installing libgtk2-perl as per the installation guide first listed, to no effect.
2.) Digging deeper I read the INSTALL.MD file that comes with the pull, a copy of which can be found here. In it, it requires placing the obmenu-generator folder you get from the pull into the PATH. I have done so by editing my .profile file. The folder now appears on the PATH, at the end.

echo $PATH

obmenu-generator stil doesn’t work.
3.)I tried removing the existing menu, to “force” the use of another menu file (hoping that would be obmenu-generator) by:

~/.config/openbox$mv menu.xml ./menu.xml.bak

but all that happened was Openbox opened the same menu you see when you first install Openbox (I don’t know where this config file is located, I assumed there was only the menu.xml file. But OB found it somewhere…)

I’m sort of at a loss, I’m not sure what’s going on exactly. It seems I’ve followed all the installation instructions, but I clearly missed something. My guess is I need to update the rc.xml file in some way, but I’m not sure what way that is. Pertaining to that, however, I have already in my rc.xml file the lines

<mousebind button="Right" action="Press">
<action name="ShowMenu">

I thought the issue lay in the definition of root-menu, but in the obmenu-generator.pl file there is a line

my $menu_id         = "root-menu";

However, it is still possible this call is being run after (or before, and being re-written) wherever Openbox looks for root-menu definitions in the rc.xml

Any and all help will be appreciated, even if that help is “please post this on a different forum because it’s not explicitly XFCE/Mint related”


Investigating the error found at line 194 of /usr/bin/obmenu-generator I realized the code was attempting to call a file path that didn’t exist. In line 51, obmenu-generator defines the config directory as

my $xdg_config_home = "$home_dir/.config/obmenu-generator";

During installation a file titled obmenu-generator is created and placed in ~/.config/obmenu-generator . Line 51 is looking for a directory. I didn’t realize this is what the call needed.

The fix was multi-part.

-I deleted the file in ~/.config with

 rm ~/.config/obmenu-generator

-I moved the folder created during the git pull, located at ~/obmenu-generator and issued

 mv obmenu-generator/ ~/.config/obmenu-generator

and changed permissions with

 cd .config/
 sudo chmod -R u=rwx obmenu-generator

-When I performed the git pull in step 1.) at the top of the page I did not receive a config.pl file. I found one here. A few lines in this file must be edited to work with your system, specifically: the editor definition, desktop_files_paths, gtk_rc_filename, terminal, VERSION. Paths will need the correct user name because the one from the link above is “edps”, and for me the VERSION I changed to the version listed in the file obmenu-generator line 38 (for me this was 0.84).


 openbox --reconfigure && openbox --restart
 obmenu-generator -p

This was enough to solve my problem, the main issues being the lack of obmenu-generator folder in .config and the missing config.pl file.

5 thoughts on “Obmenu-Generator, how to get it running on any linux

  1. well, for example the first line :

    “For those Openbox users who want a dynanamical….”


  2. 🙂 I know, thank Linus for spell checking abilities in editing.

    Imagine if we all that contribute to the linux community employed expert writers to edit our posts. Sometimes even in the small descriptions, summaries, help sections you find spelling errors and just simply mistyped terms. It is what makes it all so human like and not machine like, like those commercial distributions and OS’s. Is OS’s correct?

    Also consider that a huge percentage of Linux contributors are not even native English speakers but we are trying our best as this is the digital language from which translation stems from. You simply are handicapped in computer world, technology world, and possibly science world without English. It is the language of capitalism. In theoretical astronomy and physics you better learn Russian.

    I don’t like to read through poor spelling but tolerate it when the importance is to communicate and proper writing is not the object of those who have done the work. It is very common in technical manuals to identify poor use of the language, but wonder how much did I pay extra for a machine that came with a linguistically perfect manual.

    Have you ever seen technical manuals for machines that came from Italy? The artwork and drawings stick out as very different than the norm. But as technical manuals go it is hard to beat older American trends.

    C’est la vie!


  3. Pingback: Openbox tweaks and tricks – no {dbus,ck2,elogind,dm} no user services needed | systemd-free linux community

If your comment is considered off-topic a new topic will be created with your comment to continue a different discussion. This community is based on open and free communication, meaning we must all respect all in minimizing the exercise of freedom to disrupt such communication. Feel free to post what you think but keep in mind the subject matter discussed. It is just as easy to start a new topic as it is to dilute the content of an existing discussion.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.