config: barpyrus: config.py: add conky_icon function for easy formatting

In order to not having to repeat the same string sequence over and over
again there now is a helper method which does exactly this.
This commit is contained in:
Thomas Preisner 2018-03-02 01:38:17 +01:00
parent e31c496951
commit 35d203b5cd

View file

@ -46,6 +46,12 @@ color = {
def frame(content, bg, fg, padding = (3, 3)):
return Theme(bg = color[bg], fg = color[fg], padding = padding)(content)
# function to insert colored icon into conky_text
def conky_icon(icon_code, icon_color, text_color = 'lightgrey'):
text = '%{F\\' + color[icon_color] + '}%{T2}' + icon_code + '%{T-}'
text += '%{F\\' + color[text_color] + '}'
return text
# conky specific configuration
conky_text = ''