Browse Source

Merge remote-tracking branch 'mrbrainsample/master'

pull/1/merge
George Vlahavas 11 years ago
parent
commit
fbb3b87da3
  1. 37
      src/xdgmenumaker

37
src/xdgmenumaker

@ -108,18 +108,24 @@ class MenuEntry:
return repr((self.category, self.name, self.icon, self.command)) return repr((self.category, self.name, self.icon, self.command))
def icon_full_path(icon): def icon_full_path(icon):
icon = os.path.basename(icon) # If the icon path is absolute and exists, leave it alone.
if icon.endswith('.png'): # This takes care of software that has its own icons stored
icon = icon.replace('.png', '') # in non-standard directories
elif icon.endswith('.svg'): if os.path.exists(icon) == True:
icon = icon.replace('.svg', '') return icon
elif icon.endswith('.xpm'): else:
icon = icon.replace('.xpm', '') icon = os.path.basename(icon)
icon_theme = gtk.icon_theme_get_default() if icon.endswith('.png'):
icon = icon_theme.lookup_icon(icon, 16, gtk.ICON_LOOKUP_NO_SVG) icon = icon.replace('.png', '')
if icon: elif icon.endswith('.svg'):
icon = icon.get_filename() icon = icon.replace('.svg', '')
return icon elif icon.endswith('.xpm'):
icon = icon.replace('.xpm', '')
icon_theme = gtk.icon_theme_get_default()
icon = icon_theme.lookup_icon(icon, 16, gtk.ICON_LOOKUP_NO_SVG)
if icon:
icon = icon.get_filename()
return icon
def get_entry_info(desktopfile): def get_entry_info(desktopfile):
global desktop global desktop
@ -278,7 +284,10 @@ def fluxboxmenu():
spacing = ' ' spacing = ' '
if seticon == True: if seticon == True:
app_icon = icon_full_path(applications_icon) app_icon = icon_full_path(applications_icon)
print '[submenu] ('+applications+') <'+app_icon+'>' if app_icon is None:
print '[submenu] ('+applications+')'
else:
print '[submenu] ('+applications+') <'+app_icon+'>'
else: else:
print '[submenu] ('+applications+')' print '[submenu] ('+applications+')'
else: else:
@ -327,6 +336,8 @@ def icewmmenu():
spacing = ' ' spacing = ' '
if seticon == True: if seticon == True:
app_icon = icon_full_path(applications_icon) app_icon = icon_full_path(applications_icon)
if app_icon is None:
app_icon = "_none_"
print 'menu "'+applications+'" '+app_icon+' {' print 'menu "'+applications+'" '+app_icon+' {'
else: else:
print 'menu "'+applications+'" _none_ {' print 'menu "'+applications+'" _none_ {'

Loading…
Cancel
Save