mirror of
https://github.com/powerline/powerline.git
synced 2025-07-24 06:15:41 +02:00
parent
e3bebcc5b5
commit
7c65ee9703
@ -1105,6 +1105,7 @@ class NowPlayingSegment(object):
|
||||
now_playing = NowPlayingSegment()
|
||||
|
||||
|
||||
try:
|
||||
if os.path.exists('/sys/class/power_supply/'):
|
||||
_linux_bat_fmt = '/sys/class/power_supply/{0}/capacity'
|
||||
_linux_bat = 'BAT0'
|
||||
@ -1115,7 +1116,10 @@ if os.path.exists('/sys/class/power_supply/'):
|
||||
def _get_capacity(pl):
|
||||
with open(_linux_bat_fmt.format(_linux_bat), 'r') as f:
|
||||
return int(float(f.readline().split()[0]))
|
||||
elif os.path.exists('/usr/bin/pmset'):
|
||||
else:
|
||||
raise NotImplementedError
|
||||
except NotImplementedError:
|
||||
if os.path.exists('/usr/bin/pmset'):
|
||||
def _get_capacity(pl):
|
||||
import re
|
||||
battery_summary = run_cmd(pl, ['pmset', '-g', 'batt'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user