xdg-icon 506 B

123456789101112131415161718192021
  1. #!/usr/bin/python2
  2. import xdg.IconTheme
  3. import sys
  4. import os
  5. themes = ['Humanity', 'Adwaita', 'gnome', 'oxygen']
  6. themes = themes + sorted([d for d in os.listdir("/usr/share/icons") if d not in themes and os.path.isdir("/usr/share/icons/" + d)])
  7. if len(sys.argv) < 3:
  8. print "Usage:", sys.argv[0], "ICON SIZE"
  9. sys.exit(1)
  10. for theme in themes:
  11. icon = xdg.IconTheme.getIconPath(sys.argv[1], theme = theme, size = int(sys.argv[2]))
  12. if icon is not None:
  13. break
  14. if icon is None:
  15. sys.exit(1)
  16. print icon