diff --git a/plyer/platforms/macosx/battery.py b/plyer/platforms/macosx/battery.py index 57965d32..117274aa 100644 --- a/plyer/platforms/macosx/battery.py +++ b/plyer/platforms/macosx/battery.py @@ -32,11 +32,11 @@ def _get_state(self): is_charging = max_capacity = current_capacity = None for line in output.decode('utf-8').splitlines(): - if 'IsCharging' in line: + if 'IsCharging' == line.rpartition('=')[0].strip()[1:-1]: is_charging = line.rpartition('=')[-1].strip() - if 'MaxCapacity' in line: + if 'MaxCapacity' == line.rpartition('=')[0].strip()[1:-1]: max_capacity = float(line.rpartition('=')[-1].strip()) - if 'CurrentCapacity' in line: + if 'CurrentCapacity' == line.rpartition('=')[0].strip()[1:-1]: current_capacity = float(line.rpartition('=')[-1].strip()) if is_charging: