dotfiles/polybar/.config/polybar/volume.sh

19 lines
336 B
Bash
Executable File

#!/usr/bin/env bash
color8="#88C0D0"
icon(){
printf "%s\\n" "%{F${color8}}${1}%{F}"
}
volume="$(mixer vol | cut -c 36- | cut -c -3)"
case "$volume" in
0|[0-9]) vol_icon=" " ;;
1?|2?|3?) vol_icon="" ;;
4?|5?|6?) vol_icon="" ;;
*) vol_icon="" ;;
esac
printf "%s\\n" "$(icon "$vol_icon") ${volume}%"