cfg/.config/i3blocks/volume
Knut Ahlers 001b490654
First draft of i3blocks status bar
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2018-12-03 00:43:08 +01:00

28 lines
568 B
Python
Executable file

#!/usr/bin/env python
import subprocess
def main():
volume = subprocess.check_output([
'pulsemixer', '--get-volume',
]).decode('utf-8').strip().split(' ')
minvol = min([int(i) for i in volume])
mute = int(subprocess.check_output([
'pulsemixer', '--get-mute',
]).decode('utf-8').strip()) == 1
icon = '\uf9c3' if mute else '\uf9c2'
text = '{} {}%'.format(icon, minvol)
color = '#7f7f7f' if mute else ''
print('\n'.join([
text,
text,
color,
]))
if __name__ == '__main__':
main()