[modules/battery] Ignore errors when reading status
Reading status - similar to reading the capacity - might fail, just ignore that error. see #221
This commit is contained in:
parent
82db0a14c1
commit
bbfb6fc095
1 changed files with 2 additions and 0 deletions
|
@ -107,6 +107,8 @@ class Module(bumblebee.engine.Module):
|
||||||
charge = ""
|
charge = ""
|
||||||
with open("{}/status".format(widget.name)) as f:
|
with open("{}/status".format(widget.name)) as f:
|
||||||
charge = f.read().strip()
|
charge = f.read().strip()
|
||||||
|
except IOError:
|
||||||
|
pass
|
||||||
if charge == "Discharging":
|
if charge == "Discharging":
|
||||||
state.append("discharging-{}".format(min([10, 25, 50, 80, 100], key=lambda i: abs(i-capacity))))
|
state.append("discharging-{}".format(min([10, 25, 50, 80, 100], key=lambda i: abs(i-capacity))))
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue