From 6895cafcf331a5a50de7638fdf21fdd9ee1fea43 Mon Sep 17 00:00:00 2001 From: Sahil Joseph Date: Fri, 22 Jul 2016 20:42:25 +0530 Subject: [PATCH] Fixed issue #221 UPower daemon does not have a option called power supply instead in "state" it shows the state weather its charging or not. --- plyer/platforms/linux/battery.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plyer/platforms/linux/battery.py b/plyer/platforms/linux/battery.py index 0cdb76353..4126ce0c1 100644 --- a/plyer/platforms/linux/battery.py +++ b/plyer/platforms/linux/battery.py @@ -23,15 +23,15 @@ def _get_state(self): if not output: return status - power_supply = percentage = None + state = percentage = None for l in output.splitlines(): - if 'power supply' in l: - power_supply = l.rpartition(':')[-1].strip() + if 'state' in l: + state = l.rpartition(':')[-1].strip() if 'percentage' in l: percentage = float(l.rpartition(':')[-1].strip()[:-1]) - if(power_supply): - status['isCharging'] = power_supply != "yes" + if(state): + status['isCharging'] = state == "charging" status['percentage'] = percentage