Modification i3blocks volume

This commit is contained in:
Breizh 2018-03-28 21:50:21 +02:00
parent d6605642be
commit 06ce1a7704

View file

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