From 2cad9f2e4663729d1bdc24149328b6d89aa68737 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 30 Aug 2019 15:55:00 +0200 Subject: [PATCH] [battery_all] Fixed the battery path and used os to solve for the correct paths --- bumblebee/modules/battery_all.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bumblebee/modules/battery_all.py b/bumblebee/modules/battery_all.py index 868798f..8f4cebc 100644 --- a/bumblebee/modules/battery_all.py +++ b/bumblebee/modules/battery_all.py @@ -25,11 +25,10 @@ except ImportError: class Module(bumblebee.engine.Module): def __init__(self, engine, config): self._batteries = [] - # TODO: list all batteries - self._batteries.append("/sys/class/power_supply/BAT0") - self._batteries.append("/sys/class/power_supply/BAT1") - self._batteries.append("/sys/class/power_supply/battery") - + for battery in os.listdir('/sys/class/power_supply/'): + if not any(i in battery for i in ['AC', 'hidpp']): + self._batteries.append("/sys/class/power_supply/" + battery) + super(Module, self).__init__(engine, config, bumblebee.output.Widget(full_text=self.capacity)) engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,