Browse Source

Add --icon-theme option

Add a --icon-theme command line option to specify in XDG icon theme
search for icons; defaults to 'hicolor'.
pull/24/head
Pino Toscano 4 years ago
parent
commit
f21b67f1c3
  1. 10
      src/xdgmenumaker

10
src/xdgmenumaker

@ -28,6 +28,7 @@ submenu = True
pekwmdynamic = False pekwmdynamic = False
twmtitles = False twmtitles = False
max_icon_size = False max_icon_size = False
icontheme = 'hicolor'
# the following line gets changed by the Makefile. If it is set to # the following line gets changed by the Makefile. If it is set to
# 'not_set' it looks in the currect directory tree for the .directory # 'not_set' it looks in the currect directory tree for the .directory
@ -163,6 +164,7 @@ def main(argv):
global pekwmdynamic global pekwmdynamic
global twmtitles global twmtitles
global max_icon_size global max_icon_size
global icontheme
try: try:
opts, args = getopt.getopt(argv, "hins:f:", ["help", "icons", opts, args = getopt.getopt(argv, "hins:f:", ["help", "icons",
"no-submenu", "no-submenu",
@ -171,7 +173,8 @@ def main(argv):
"max-icon-size", "max-icon-size",
"no-svg", "no-svg",
"size=", "size=",
"format="]) "format=",
"icon-theme="])
except getopt.GetoptError: except getopt.GetoptError:
usage() usage()
sys.exit(2) sys.exit(2)
@ -211,6 +214,8 @@ def main(argv):
nosvg = True nosvg = True
elif opt in ("-f", "--format"): elif opt in ("-f", "--format"):
desktop = arg desktop = arg
elif opt == "--icon-theme":
icontheme = arg
if not desktop: if not desktop:
usage() usage()
sys.exit('ERROR: You must specify the output format with -f') sys.exit('ERROR: You must specify the output format with -f')
@ -257,6 +262,7 @@ def usage():
print(' --max-icon-size restrict the icon sizes to the specified size') print(' --max-icon-size restrict the icon sizes to the specified size')
print(' --pekwm-dynamic generate dynamic menus for pekwm') print(' --pekwm-dynamic generate dynamic menus for pekwm')
print(' --twm-titles show menu titles in twm menus') print(' --twm-titles show menu titles in twm menus')
print(' --icon-theme XDG icon theme to lookup icons in (default: hicolor)')
print(' -h, --help show this help message') print(' -h, --help show this help message')
print(' You have to specify the output format using the -f switch.') print(' You have to specify the output format using the -f switch.')
print() print()
@ -292,7 +298,7 @@ def icon_max_size(icon):
def icon_full_path(icon): def icon_full_path(icon):
args = { args = {
'size': iconsize, 'size': iconsize,
'theme': 'hicolor' 'theme': icontheme
} }
lookup_svg = True lookup_svg = True
if not desktop == "jwm" or nosvg: if not desktop == "jwm" or nosvg:

Loading…
Cancel
Save