def volume_plugin(colors):
path=os.path.realpath(__file__)
path=os.path.dirname(path)
p=subprocess.run(['sh',path+"/volume_level.sh"], stdout=subprocess.PIPE)
string=''
for c in str(p.stdout):
if c.isnumeric():
string+=c
level=int(string)
p=subprocess.run(['sh', path+"/volume_muted.sh"], stdout=subprocess.PIPE)
if str(p.stdout)[2]=='y':
muted=True
else:
muted=False
string='%{F'+colors["lwhite"]+'}'
if level>0 and not muted:
if level>=50:
string+='\uf028'
else:
string+='\uf027'
else:
string+='\uf026'
string+=" %{F"+colors["lwhite"]+"}%3.0f"%level+'%'
return string
评论列表
文章目录