[core/theme] Fix retrieval of rotating theme values (e.g. battery)

When rotating theme values (e.g. the "charge" icon of the battery
module(s)), until now, the code just showed the raw list (because it
wasn't aware of the need to rotate).
This commit is contained in:
tobi-wan-kenobi 2020-04-02 12:51:08 +02:00
parent 658fbd2c1c
commit 2756f8fbb3
2 changed files with 7 additions and 0 deletions

View file

@ -116,6 +116,12 @@ class Theme(object):
if not type(value) in (list, dict):
value = self.__keywords.get(value, value)
if isinstance(value, list):
key = '__{}-idx__'.format(key)
idx = widget.get(key, 0)
widget.set(key, (idx + 1) % len(value))
value = value[idx]
self.__current[key] = value
return value

View file

@ -35,3 +35,4 @@
- themes: use colors to improve theme readability
- brightness: read from CLI tools
- input: use events?
- themes: rotating icons (battery!)