Where to Discuss?


Goal: Using OB Menu Generator as Static Openbox menu.

Table of Content

1: OB Menu Generator

Nowadays, people are using automation, rather than a crafting menu manually. There is this openbox-obmenu-generator tools,.

It is cleverly using perl array preprocessor, before converting to xml. Since it has dfferent format than the original xml, I put this on different menu article.


First you need to clone. or install using AUR. Depend on your distribution.

$ git clone https://github.com/trizen/obmenu-generator

You can see more in manual installation page on github.

Consider also reading installation detail on [ OBMenu Generator: Install ].


Now you need to copy schema.pl to ~/.config/obmenu-generator. It contain predefined array in perl.


# ...

our $SCHEMA = [

    #          COMMAND                 LABEL              ICON
    {item => ['xdg-open .',       'File Manager', 'system-file-manager']},
    {item => ['xterm',            'Terminal',     'utilities-terminal']},
    {item => ['xdg-open http://', 'Web Browser',  'web-browser']},
    {item => ['gmrun',            'Run command',  'system-run']},

    # ...

Default Menu

Just run the obmenu-generator.

$ ./obmenu-generator -s > ~/.config/openbox/menu.xml 

And do not forget to Reconfigure openbox.


Adding icon is as simply as adding -i argument.

$ ./obmenu-generator -s -i > ~/.config/openbox/menu.xml 

There will be temporary icon directory in ~/.config/obmenu-generator/icons/.

And in the generated menu.xml, it has this hardcoded icon path:

    <item label="File Manager" icon="/home/epsi/.config/obmenu-generator/icons/bd6f34dfc816e8ba8054aeb1419095a4.png">
        <action name="Execute"><command><![CDATA[xdg-open .]]></command></action>

openbox Config: obmenu-generator with icon

Icon Theme Case

I’m using Breeze, but I want Numix Circle, in my Menu.

All I need is to change ~/.gtkrc-2.0 to Numix Circle temporarily, run obmenu-generator, and get it back to Breeze.

You can also use lxapperance to do this temporarily.


2: Dynamic Menu

We can also achieve dynamic menu, by editing the menu.xml, into this:

<?xml version="1.0" encoding="utf-8"?>
<openbox_menu xmlns="http://openbox.org/"
    <menu id="root-menu" label="obmenu-generator" execute="/usr/bin/obmenu-generator" />

But I’d prefer static menu, that is faster.

3: Custom Schema

It is time to edit schema.pl. Most of the ideas comes form ArcoLinux.


Put this on top most:

    # Favorites
    {begin => ['Favorites', 'utilities-desktop-extra']},
        {sep => 'Terminal'},
        {item => ['urxvt',              'URxvt',            'terminal']},
        {item => ['xfce4-terminal',     'XFCE4 Terminal',   'terminal']},
        {sep => 'Office'},
        {item => ['libreoffice',        'LibreOffice',      'libreoffice-main']},
        {sep => 'File Manager'},        
        {item => ['pcmanfm-qt',         'PC Man FM Qt',     'file-manager']},
        {item => ['thunar',             'Thunar',           'thunar']},
        {sep => 'Internet'},
        {item => ['firefox',            'Firefox',          'firefox']},
        {item => ['chromium',           'Chromium',         'chromium']},
        {item => ['midori',             'Midori',           'midori']},
        {item => ['transmission',       'Transmission',     'transmission']},
        {item => ['telegram',           'Telegram',         'telegram']},
        {sep => 'Media'},
        {item => ['clementine',         'Clementine',       'clementine']},
        {item => ['vlc',                'VLC',              'vlc']},
        {item => ['xfce4-screenshoter', 'Screenshot',       'camera']},
        {sep => 'Editor'},
        {item => ['geany',              'Geany',            'geany']},
        {sep => 'System'},
        {item => ["xfce4-taskmanager",  'Taskmanager',      'gnome-system-monitor']},
        {item => ["hardinfo",           'Hardinfo',         'hardinfo']},
    {end => undef},

Replace Default Application

Comment unused line, and add these lines:

    #          COMMAND                 LABEL              ICON
    # {item => ['xdg-open .',       'File Manager', 'system-file-manager']},
    # {item => ['xterm',            'Terminal',     'utilities-terminal']},
    # {item => ['xdg-open http://', 'Web Browser',  'web-browser']},
    {item => ['gmrun',            'Run command',  'system-run']},
    {sep => undef},

    {item => ['exo-open --launch TerminalEmulator',                                 'Terminal',          'terminal']},
    {item => ['exo-open --launch FileManager',                                      'File Manager',      'file-manager']},
    {item => ['exo-open --launch WebBrowser ',                                      'Web Browser',       'webbrowser-app']},

Categories Remain Intact

    {sep => 'Categories'},

    #          NAME            LABEL                ICON
    {cat => ['utility',     'Accessories', 'applications-utilities']},
    {cat => ['development', 'Development', 'applications-development']},
    {cat => ['education',   'Education',   'applications-science']},
    {cat => ['game',        'Games',       'applications-games']},
    {cat => ['graphics',    'Graphics',    'applications-graphics']},
    {cat => ['audiovideo',  'Multimedia',  'applications-multimedia']},
    {cat => ['network',     'Network',     'applications-internet']},
    {cat => ['office',      'Office',      'applications-office']},
    {cat => ['other',       'Other',       'applications-other']},
    {cat => ['settings',    'Settings',    'applications-accessories']},
    {cat => ['system',      'System',      'applications-system']},

Add Places

    {sep => undef},
    {pipe => ['/home/epsi/.config/openbox/bin/bl-places-pipemenu',         'Places',       'folder']},


    {pipe => ['/home/epsi/.config/openbox/bin/bl-help-pipemenu',              'Help &amp; Resources',              'info']},
    {sep  => undef},

    ## The xscreensaver lock command
    {item => ['xscreensaver-command -lock', 'Lock', 'system-lock-screen']},

    ## This option uses the default Openbox's "Exit" action
    # {exit => ['Exit', 'application-exit']},

    ## This uses the 'oblogout' menu
    {item => ['oblogout', 'Exit', 'application-exit']},


$ ./obmenu-generator -s -i > ~/.config/openbox/menu.xml 

And do not forget to Reconfigure openbox.

openbox Config: obmenu-generator custom schema.pl

What’s Next?

We are almost finished with openbox configuration.

Consider continue reading [ Openbox: Exit ].