Application menu for Openbox

From Void Linux Wiki
Jump to: navigation, search

The stock Openbox didn't have an application menu holding the installed package. The main solution is to install some program or script that creates it on the fly for you.

Here you will find one solution among many others, maybe not the best but it works quite well. The script is very versatile and can be configured as a pipe menu, a static menu and even replace the whole menu.xml.

Installation

First off, install the obmenu-generator package:

# xbps-install -S obmenu-generator

Next, copy this file:

# cp /usr/share/doc/obmenu-generator/schema.pl.apps ~/.config/obmenu-generator/schema.pl

Now tailor ~/.config/obmenu-generator/schema.pl to your needs, the most common modification is to translate the category names to your language. Search for these lines:

 <begin code extract>
   {sep => 'Applications'},


   #          NAME            LABEL                ICON
   {cat => ['utility',     'Accessories', 'applications-utilities']},
   {cat => ['development', 'Development', 'applications-development']},
 <end code extract>

The LABEL column is the place where you localize the names.

You can also modify the submenu title in the line:

{sep => "< Your preferred name >"},

After you are done with your changes, insert this line in your Openbox menu.xml file, in the place where you want the menu to appear:

<menu id="obmenu-generator" label="<Your menu name>" execute="/usr/bin/obmenu-generator -i"/>

Reconfigure Openbox (there is usually a menu entry for that), and enjoy your new application menu.

There is another file you may need to modify to adapt it to your language: ~/.config/obmenu-generator/config.pl. This is created by obmenu-generator, but you can customize it. To do this, search for the line that begins with "name_keys" near the end, and replace the bracketed it string with your preferred language code.

"name_keys" => ['Name[it]', 'GenericName[it]', 'Name'],

According to the cryptic comment in the script, the modifications done to config.pl may be overridden by the program itself, so be prepared to restore your changes here from time to time. Creating a backup of this file is probably a good idea.

The script is very powerful and has many other uses, including autogenerating menu.xml. Be sure to read the documentation interspersed in all these files (/usr/bin/obmenu-generator, schema.pl and config.pl); visiting the support site is probably a good idea as well.