Picking the external battery over the internal

(At least on thinkpads)
This commit is contained in:
Florian Feldmann 2020-02-02 03:24:03 +01:00 committed by GitHub
parent a9b8c9bb39
commit 9f210a0301
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,10 +6,10 @@ class Segment(BasicSegment):
def add_to_powerline(self):
# See discussion in https://github.com/banga/powerline-shell/pull/204
# regarding the directory where battery info is saved
if os.path.exists("/sys/class/power_supply/BAT0"):
dir_ = "/sys/class/power_supply/BAT0"
elif os.path.exists("/sys/class/power_supply/BAT1"):
if os.path.exists("/sys/class/power_supply/BAT1"):
dir_ = "/sys/class/power_supply/BAT1"
elif os.path.exists("/sys/class/power_supply/BAT0"):
dir_ = "/sys/class/power_supply/BAT0"
else:
warn("battery directory could not be found")
return