dotfiles/.i3blocks/volume

30 lines
425 B
Text
Raw Normal View History

#!/bin/bash
2019-09-09 20:04:37 +02:00
if [[ "$instance" == mic ]]
then
options=" --default-source"
fi
2019-09-09 20:04:37 +02:00
mixer="pamixer${options}"
2019-09-09 20:04:37 +02:00
case $button in
1) $mixer -d 1;;
2) $mixer -t;;
3) $mixer -i 1;;
4) $mixer -i 5;;
5) $mixer -d 5;;
esac
2019-09-09 20:04:37 +02:00
volume="$($mixer --get-volume)"
muted="$($mixer --get-mute)"
2019-09-09 20:04:37 +02:00
if $muted
then
color="#F2777A"
else
color="#99CC99"
fi
2019-09-09 20:04:37 +02:00
printf "%s <span foreground=\"%s\">%2d%%</span>\n" "$BLOCK_INSTANCE" "$color" "$volume"