cfg/.config/i3blocks/volume
Knut Ahlers 0565b7ad07
Fix color and icon in volume widget
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2022-09-02 15:53:43 +02:00

28 lines
575 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 = '\uf6a9' if mute else '\uf6a8'
text = '{} {}%'.format(icon, minvol)
color = '#7f7f7f' if mute else '#ffffff'
print('\n'.join([
text,
text,
color,
]))
if __name__ == '__main__':
main()