Modification i3blocks volume

This commit is contained in:
Breizh 2018-03-28 21:50:21 +02:00
parent 0b41aa32f6
commit 3872ae7f5d

View file

@ -57,24 +57,28 @@ format() {
then
# TYPE_MUTE=" "
# TYPE=" "
TYPE="vol "
TYPE_MUTE="vol "
# TYPE="vol "
# TYPE_MUTE="vol "
TYPE='<span foreground=\"#99CC99\">'
TYPE_MUTE='<span foreground=\"#F2777A\">'
elif [[ $SCONTROL = "Capture" ]]
then
# TYPE_MUTE=" "
# TYPE=" "
TYPE="mic "
TYPE_MUTE="mic "
# TYPE="mic "
# TYPE_MUTE="mic "
TYPE='<span foreground=\"#99CC99\">'
TYPE_MUTE='<span foreground=\"#F2777A\">'
fi
perl_filter='if (/.*\[(\d+%)\] (\[(-?\d+.\d+dB)\] )?\[(on|off)\]/)'
perl_filter+='{CORE::say $4 eq "off" ? "'
perl_filter+=$TYPE_MUTE
perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo '$1')
perl_filter+='\n\n#f2777a" : "'
perl_filter+='</span>" : "'
perl_filter+=$TYPE
# If dB was selected, print that instead
perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo '$1')
perl_filter+='\n\n#99cc99"; exit}'
perl_filter+='</span>"; exit}'
perl -ne "$perl_filter"
}