added check for missing or broken battery

This commit is contained in:
Sheppy
2017-03-28 09:50:04 +02:00
parent c9161c20ef
commit a18421f315

View File

@@ -76,6 +76,8 @@ def battery():
if hl_utils.is_laptop(): if hl_utils.is_laptop():
try: try:
bat = hl_utils.shexec("acpi -b") bat = hl_utils.shexec("acpi -b")
if bat == '':
return color_panel("BATTERY FAILURE",RED)
bat = re.compile(r'Battery [0-9]+: ').sub('',bat) bat = re.compile(r'Battery [0-9]+: ').sub('',bat)
plain = int(bat.split('%')[0][-2:].rstrip('%')) plain = int(bat.split('%')[0][-2:].rstrip('%'))