Browse Source

Exit if no X session is found

Catch the exception that is raised when an icon lookup is performed
without an active X session and bail out.
pull/10/head
George Vlahavas 7 years ago
parent
commit
21a399042f
  1. 5
      src/xdgmenumaker

5
src/xdgmenumaker

@ -305,7 +305,10 @@ def icon_full_path(icon):
return icon
icon = icon_strip(icon)
icon_theme = gtk.icon_theme_get_default()
icon = icon_theme.lookup_icon(icon, iconsize, gtk.ICON_LOOKUP_NO_SVG)
try:
icon = icon_theme.lookup_icon(icon, iconsize, gtk.ICON_LOOKUP_NO_SVG)
except AttributeError:
sys.exit('ERROR: You need to run xdgmenumaker inside an X session.')
if icon:
icon = icon.get_filename()
if max_icon_size:

Loading…
Cancel
Save