diff --git a/src/xdgmenumaker b/src/xdgmenumaker index b57de14..b924a70 100755 --- a/src/xdgmenumaker +++ b/src/xdgmenumaker @@ -95,6 +95,8 @@ def main(argv): windowmakermenu() elif desktop == "icewm": icewmmenu() + elif desktop == "pekwm": + pekwmmenu() else: usage() sys.exit(2) @@ -103,7 +105,7 @@ def usage(): print 'USAGE:', os.path.basename(sys.argv[0]), '[OPTIONS]' print print 'OPTIONS:' - print ' -f, --format the output format to use. Valid options are fluxbox, icewm and windowmaker' + print ' -f, --format the output format to use. Valid options are fluxbox, icewm, windowmaker and pekwm' print ' -i, --icons enable support for icons in the menus. Only works with fluxbox, icewm' print ' -n, --no-submenu do not create a submenu. Only works with fluxbox, icewm' print ' -h, --help show this help message' @@ -389,5 +391,47 @@ def icewmmenu(): if submenu is True: print '}' +def pekwmmenu(): + global seticon + global submenu + if submenu is True: + spacing = ' ' + if seticon == True: + app_icon = icon_full_path(applications_icon) + print 'Submenu = "'+applications+'" { Icon = "'+app_icon+'"' + else: + print 'Submenu = "'+applications+'" {' + else: + spacing = '' + for i in menu(): + category = i[0] + cat_icon = category_icon(category) + cat_icon = icon_full_path(cat_icon) + if seticon is True and cat_icon is not None: + print spacing+'Submenu = "'+category+'" { Icon = "'+cat_icon+'"' + else: + print spacing+'Submenu = "'+category+'" {' + for j in i[1]: + name = j[0] + icon = j[1] + # for some apps (like netbeans) the command is launched with + # /bin/sh "command" + # and the quotes get mixed up with the quotes pekwm puts + # around Actions, so we're just stripping the quotes + command = j[2].replace('"', '') + path = j[3] + if path is not None: + # pekwm doesn't like "cd path ; command", but it works + # with "&&" and "||", so we'll launch the command even if the + # path does not exist + command = 'cd '+path+' && '+command+' || '+command + if seticon is True and icon is not None: + print spacing+' Entry = "'+name+'" { Icon = "'+icon+'"; Actions = "Exec '+command+' &" }' + else: + print spacing+' Entry = "'+name+'" { Actions = "Exec '+command+' &" }' + print spacing+'}' + if submenu is True: + print '}' + if __name__ == "__main__": main(sys.argv[1:])