make it possible to use home alias ~ for icon-image

This commit is contained in:
2021-04-05 22:26:15 +02:00
parent 67ff81900d
commit d82503b4ff
2 changed files with 12 additions and 10 deletions

View File

@@ -203,9 +203,9 @@ def application(request):
Button(empty=True, a=eval(var)) Button(empty=True, a=eval(var))
elif 'icon-image' in j and j['icon-image'] != '': elif 'icon-image' in j and j['icon-image'] != '':
svg = '' svg = ''
if path.isfile(j['icon-image']): if path.isfile(path.expanduser(j['icon-image'])):
try: try:
with open(j['icon-image']) as f: with open(path.expanduser(j['icon-image'])) as f:
svg = f.read() svg = f.read()
except Exception as e: except Exception as e:
print(f"{e}") print(f"{e}")

View File

@@ -20,18 +20,20 @@
# second command # second command
# ... # ...
# icon = Font Awesome name # icon = Font Awesome name
# icon-image = path to svg file
# #
# : N. optional group/row specification # : N. optional group/row specification
# : NAME id, name of the button # : NAME id, name of the button
# : color-bg background color # : color-bg background color
# : color-bg forground color # : color-bg forground color
# : command command(s) to run # : command command(s) to run
# : icon use icon instead of NAME (Font Awesome), e.g.: fas fa-play # : icon use icon instead of NAME (Font Awesome), e.g.: fas fa-play
# : icon-image absolute path to svg file
# #
# [N.empty.NAME] # [N.empty.NAME]
# #
# : N. optional number to specify group/row # : N. optional number to specify group/row
# : NAME id, name of the button # : NAME id, name of the button
[gui] [gui]
width = 800 width = 800