41 lines
843 B
Bash
Executable File
41 lines
843 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Module prints out current volume, or shows 'MUTED' if muted.
|
|
# Also shows icons corresponding to volume level.
|
|
|
|
# Global config
|
|
source config
|
|
|
|
# Emoji used by module
|
|
i_max=" "
|
|
i_med=" "
|
|
i_low=" "
|
|
i_non=" "
|
|
i_mut=" "
|
|
|
|
# At which levels to trigger emoji at
|
|
max=100
|
|
med=50
|
|
low=1
|
|
|
|
# status2d patch alternating background
|
|
# background="^b#333333^"
|
|
# background="^b#222222^"
|
|
|
|
# Show mute icon + text if muted
|
|
[ $(pamixer --get-mute) = true ] && echo $background$wb$i_mut MUTE$we^d^ && exit
|
|
|
|
# Parse current volume
|
|
vol="$(pamixer --get-volume)"
|
|
|
|
# Set icon according to volume level
|
|
case 1 in
|
|
$(($vol > $max)) ) icon=$i_max ;;
|
|
$(($vol > $med)) ) icon=$i_med ;;
|
|
$(($vol > $low)) ) icon=$i_low ;;
|
|
* ) icon=$i_non ;;
|
|
esac
|
|
|
|
# Print icon + volume (pad with 3 0s)
|
|
printf "$background$wb%s %03d%%$we^d^" $icon $vol
|