feature request: respect custom application.menus
would be cool if pmenu would handle application.menu xml files like the xfce panel launcher does: you can just specify an xml file and it draws the menu like it should. In xfce, this also works with multiple menus, so I can add one menu for applications, one for system settings to the panel. would be cool to support that to.
I tried to use openbox-menu, and apart from the fact that libmenu-cache just hung with 100% cpu on my custom application.menu, it also failed to even generate the settings.menu with "Can't get menu root directory" - so assuming the presence a root directory must be avoided in design of the xml parsing.
I use this little python script right now as a pipemenu, maybe it is useful for you.
import gmenu, re, sys
from xml.sax.saxutils import escape
def walk_menu(entry):
if entry.get_type() == gmenu.TYPE_DIRECTORY:
print '<menu id="%s" label="%s">' \
% (escape(entry.menu_id), escape(entry.get_name()))
map(walk_menu, entry.get_contents())
print '</menu>'
elif entry.get_type() == gmenu.TYPE_ENTRY and not entry.is_excluded:
print ' <item label="%s">' % \
escape(entry.get_name().replace('"', ''))
command = re.sub(' [^ ]*%[fFuUdDnNickvm]', '', entry.get_exec())
if entry.launch_in_terminal:
command = 'xterm -title "%s" -e %s' % \
(entry.get_name(), command)
print ' <action name="Execute">' + \
'<command>%s</command></action>' % escape(command)
print ' </item>'
if len(sys.argv) > 1:
menu = sys.argv[1] + '.menu'
else:
menu = 'settings.menu'
print '<?xml version="1.0" encoding="UTF-8"?>'
print '<openbox_pipe_menu>'
map(walk_menu, gmenu.lookup_tree(menu).root.get_contents())
print '</openbox_pipe_menu>'
while it works good, it does not support icons.. and I failed to add this functionality, I am not really a programmer.