From 35d203b5cd025875ae37707bdfe39040241a0434 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Fri, 2 Mar 2018 01:38:17 +0100 Subject: [PATCH] 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. --- config/barpyrus/config.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/barpyrus/config.py b/config/barpyrus/config.py index ace4a5d..dbe8bad 100644 --- a/config/barpyrus/config.py +++ b/config/barpyrus/config.py @@ -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 = ''