Skip to content

Commit

Permalink
Merge pull request #214 from vladvasiliu/master
Browse files Browse the repository at this point in the history
volume-pulseaudio: Use pango for coloring in subscribe mode.
  • Loading branch information
denisse-dev authored Oct 22, 2021
2 parents 89494c2 + 535a838 commit 0bc0984
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions volume-pulseaudio/volume-pulseaudio
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ while getopts F:Sf:adH:M:L:X:T:t:C:c:i:m:s:h opt; do
s) SCONTROL="$OPTARG" ;;
h) printf \
"Usage: volume-pulseaudio [-S] [-F format] [-f format] [-p] [-a|-d] [-H symb] [-M symb]
[-L symb] [-X symb] [-T thresh] [-t thresh] [-C color] [-c color] [-i inter]
[-m mixer] [-s scontrol] [-h]
[-L symb] [-X symb] [-T thresh] [-t thresh] [-C color] [-c color] [-i inter]
[-m mixer] [-s scontrol] [-j] [-h]
Options:
-F, -f\tOutput format (-F long format, -f short format) to use, with exposed variables:
\${SYMB}, \${VOL}, \${INDEX}, \${NAME}
Expand Down Expand Up @@ -113,8 +113,15 @@ case "$BLOCK_BUTTON" in
5) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_DELTA%- ;;
esac


function print_format {
echo "$1" | envsubst '${SYMB}${VOL}${INDEX}${NAME}'
if [[ $markup == "pango" ]] ; then
output="<span color=\"$2\">$1</span>"
else
output=$1
fi

echo "$output" | envsubst '${SYMB}${VOL}${INDEX}${NAME}'
}

function print_block {
Expand Down Expand Up @@ -158,12 +165,10 @@ sed 's/.*= "\(.*\)".*/\1/')
COLOR=$MUTED_COLOR
fi

if [[ $SUBSCRIBE == 1 ]] ; then
print_format "$LONG_FORMAT"
else
print_format "$LONG_FORMAT"
print_format "$SHORT_FORMAT"
echo "$COLOR"
print_format "$LONG_FORMAT" $COLOR
if [[ $SUBSCRIBE != 1 ]] ; then
print_format "$SHORT_FORMAT" $COLOR
echo $COLOR
fi
}

Expand Down

0 comments on commit 0bc0984

Please sign in to comment.