[core/theme] Add support for default -> prefix/suffix in themes

Themes can now define default prefix and suffix strings.

see #23
This commit is contained in:
Tobi-wan Kenobi 2016-12-08 11:52:47 +01:00
parent 64f5fc100e
commit 394ef61760
5 changed files with 45 additions and 15 deletions

View file

@ -33,10 +33,12 @@ class I3BarOutput(object):
def draw_widget(self, result, widget):
"""Draw a single widget"""
full_text = widget.full_text()
if self._theme.prefix():
full_text = "{}{}".format(self._theme.prefix(), full_text)
if self._theme.suffix():
full_text = "{}{}".format(full_text, self._theme.suffix())
prefix = self._theme.prefix(widget)
suffix = self._theme.suffix(widget)
if prefix:
full_text = "{}{}".format(prefix, full_text)
if suffix:
full_text = "{}{}".format(full_text, suffix)
result.append({
u"full_text": "{}".format(full_text)
})