[modules/battery] Fix ac and unknown display

If the computer runs on AC, display that instead of showing "100%" in
the status.

Also, if reading the charging status fails for some reason (except the
computer being on AC), go into critical state and display "n/a".

see #23
This commit is contained in:
Tobi-wan Kenobi 2016-12-11 07:28:15 +01:00
parent 2cc2cf8282
commit d91294f010
3 changed files with 19 additions and 5 deletions

View file

@ -121,8 +121,9 @@ class Theme(object):
state_themes = []
# avoid infinite recursion
if name not in widget.state():
for state in widget.state():
states = widget.state()
if name not in states:
for state in states:
state_themes.append(self._get(widget, state, {}))
value = self._defaults.get(name, default)