diff --git a/src/xdgmenumaker b/src/xdgmenumaker index 51398fb..b8f9a6b 100755 --- a/src/xdgmenumaker +++ b/src/xdgmenumaker @@ -11,6 +11,7 @@ import xdg.DesktopEntry as dentry import xdg.Exceptions as exc import xdg.BaseDirectory as bd from operator import attrgetter +from xml.sax.saxutils import escape # ConfigParser in Python2 has been renamed to configparser (all lower case) # in Python3. So, it's a good way to find out which Python version is being @@ -211,6 +212,8 @@ def main(argv): jwm() elif desktop == "compizboxmenu": compizboxmenu() + elif desktop == "openbox": + openbox() else: usage() sys.exit(2) @@ -642,6 +645,42 @@ def jwm(): print('') +def openbox(): + print('') + print('') + spacing = ' ' + for menu_category in menu(): + category = menu_category.category + cat_name = category.decode() + cat_id = 'apps-{}-menu'.format(cat_name.lower()) + cat_icon = category_icon(category) + cat_icon = icon_full_path(cat_icon) + if seticon and cat_icon is not None: + print('{s}' + .format(s=spacing, d=cat_id, c=cat_name, i=cat_icon)) + else: + print('{s}' + .format(s=spacing, d=cat_id, c=cat_name)) + + for app in menu_category.applist: + name = app.name.decode() + command = app.command + icon = app.icon + if seticon and icon is not None: + print('{s} ' + .format(s=spacing, n=escape(name), i=icon)) + else: + print('{s} ' + .format(s=spacing, n=escape(name))) + print('{} '.format(spacing)) + print('{s} {c}'.format(s=spacing, + c=command)) + print('{} '.format(spacing)) + print('{} '.format(spacing)) + print('{}'.format(spacing)) + print('') + + def compizboxmenu(): if submenu: spacing = ' '