Merge pull request #433 from martindoublem/master

[battery_all] Fixed the battery path and used os to solve for the corrects paths
This commit is contained in:
tobi-wan-kenobi 2019-08-31 06:17:18 +02:00 committed by GitHub
commit d7c6b8dde6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,10 +25,9 @@ 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))