[core/output] Add option to align scrolling

Use -p <module>.theme.align=<left|center|right> to align scrolling
output.

fixes #550
This commit is contained in:
Tobias Witek 2020-02-17 20:58:42 +01:00
parent 2cc6fcc5dc
commit 5134ce3b5b

View file

@ -72,6 +72,13 @@ def scrollable(func):
if width < 0:
return text
if len(text) <= width:
# do alignment
align = module.parameter("theme.align", "left")
print("alignment: {}".format(align))
if align == "right":
text = "{:>{}}".format(text, width)
if align == "center":
text = "{:^{}}".format(text, width)
return text
# we need to shorten