Browse Source

Extract wm_supports_icons function.

master
George Vlahavas 3 months ago
parent
commit
a7c9fc879b
  1. 16
      src/xdgmenumaker

16
src/xdgmenumaker

@ -293,9 +293,7 @@ def icon_full_path(icon):
ext = os.path.splitext(icon)[1].lower() ext = os.path.splitext(icon)[1].lower()
if os.path.exists(icon): if os.path.exists(icon):
if ext == ".svg" or ext == ".svgz": if ext == ".svg" or ext == ".svgz":
# only jwm, icewm and openbox support svg icons if wm_supports_icons(xopts['desktop']) and not xopts['nosvg']:
if (xopts['desktop'] == "jwm" or xopts['desktop'] == "icewm"
or xopts['desktop'] == "openbox") and not xopts['nosvg']:
return icon return icon
else: else:
# icon is not svg # icon is not svg
@ -307,9 +305,8 @@ def icon_full_path(icon):
icon = icon_strip(icon) icon = icon_strip(icon)
icon_theme = gtk.icon_theme_get_default() icon_theme = gtk.icon_theme_get_default()
try: try:
# JWM, IceWM and Openbox support svg icons # Only some WMs support svg icons
if (xopts['desktop'] == "jwm" or xopts['desktop'] == "icewm" if wm_supports_icons(xopts['desktop']) and not xopts['nosvg']:
or xopts['desktop'] == "openbox") and not xopts['nosvg']:
icon = icon_theme.lookup_icon(icon, xopts['iconsize'], gtk.ICON_LOOKUP_FORCE_SVG) icon = icon_theme.lookup_icon(icon, xopts['iconsize'], gtk.ICON_LOOKUP_FORCE_SVG)
# but none of the other WMs does # but none of the other WMs does
else: else:
@ -438,6 +435,13 @@ def sortedcategories(applist):
return categories return categories
def wm_supports_icons(wm):
# only jwm, icewm and openbox support svg icons
if wm == "icewm" or wm == "jwm" or wm == "openbox":
return True
return False
def desktopfilelist(): def desktopfilelist():
# if this env variable is set to 1, then only read .desktop files from the # if this env variable is set to 1, then only read .desktop files from the
# tests directory, not systemwide. This gives a standard set of .desktop # tests directory, not systemwide. This gives a standard set of .desktop

Loading…
Cancel
Save