From e653624f5aa90486d360a27ff5d80e79c4ea90fd Mon Sep 17 00:00:00 2001 From: tobi-wan-kenobi Date: Sun, 5 Apr 2020 14:27:09 +0200 Subject: [PATCH] [core/output] Re-enable basic pango support Re-enable pango as simple "pango" dict wherever a normal value (e.g. prefix, suffix) can go. --- core/output.py | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/core/output.py b/core/output.py index 3e3135e..064cc36 100644 --- a/core/output.py +++ b/core/output.py @@ -23,7 +23,7 @@ class block(object): __COMMON_THEME_FIELDS = [ 'separator', 'separator-block-width', 'default-separators', 'border-top', 'border-left', 'border-right', 'border-bottom', - 'pango', 'fg', 'bg', 'padding', 'prefix', 'suffix' + 'fg', 'bg', 'padding', 'prefix', 'suffix' ] def __init__(self, theme, module, widget): self.__attributes = {} @@ -39,6 +39,26 @@ class block(object): def set(self, key, value): self.__attributes[key] = value + def is_pango(self, attr): + if isinstance(attr, dict) and 'pango' in attr: + return True + return False + + def pangoize(self, text): + if not self.is_pango(text): + return text + self.__attributes['markup'] = 'pango' + attr = dict(text['pango']) + text = attr.get('full_text', '') + if 'full_text' in attr: + del attr['full_text'] + + result = '