From c4d1ffa5d49036d6d6c2d65f663ca8fd98b0ec55 Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado <55825613+luevano@users.noreply.github.com> Date: Thu, 26 Nov 2020 11:58:56 -0700 Subject: Fix pulse audio block --- .config/i3blocks/config | 9 +++++---- .local/bin/blocks/volume-pulseaudio | 10 +++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.config/i3blocks/config b/.config/i3blocks/config index d091156..841918e 100644 --- a/.config/i3blocks/config +++ b/.config/i3blocks/config @@ -43,15 +43,16 @@ signal=1 # LONG_FORMAT="${SYMB} ${VOL}% [${INDEX}:${NAME}]" # SHORT_FORMAT="${SYMB} ${VOL}% [${INDEX}]" AUDIO_HIGH_SYMBOL=  -# AUDIO_MED_THRESH=50 -AUDIO_MED_SYMBOL=  -# AUDIO_LOW_THRESH=0 +AUDIO_MED_THRESH=60 +AUDIO_MED_SYMBOL=  +AUDIO_LOW_THRESH=10 AUDIO_LOW_SYMBOL=  +AUDIO_MUTED_SYMBOL=  # AUDIO_DELTA=5 # DEFAULT_COLOR="#ffffff" # MUTED_COLOR="#a0a0a0" # USE_ALSA_NAME=0 -# USE_DESCRIPTION=0 +USE_DESCRIPTION=1 # SUBSCRIBE=1 requires interval=persist and always uses LONG_FORMAT # SUBSCRIBE=0 diff --git a/.local/bin/blocks/volume-pulseaudio b/.local/bin/blocks/volume-pulseaudio index bf9ace1..071537f 100755 --- a/.local/bin/blocks/volume-pulseaudio +++ b/.local/bin/blocks/volume-pulseaudio @@ -10,7 +10,7 @@ AUDIO_MED_SYMBOL=${AUDIO_MED_SYMBOL:-''} AUDIO_LOW_THRESH=${AUDIO_LOW_THRESH:-0} AUDIO_LOW_SYMBOL=${AUDIO_LOW_SYMBOL:-''} -AUDIO_MUTED_SYMBOL=${AUDIO_MUTED_SYMBOL:-' '} +AUDIO_MUTED_SYMBOL=${AUDIO_MUTED_SYMBOL:-''} AUDIO_DELTA=${AUDIO_DELTA:-5} @@ -141,7 +141,8 @@ sed 's/.*= "\(.*\)".*/\1/') elif [[ $USE_DESCRIPTION == 1 ]] ; then DESCRIPTION=$(pacmd list-sinks |\ awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\ -grep "device.description" |\ +# grep "device.description" |\ +grep "alsa.card_name" |\ head -n1 |\ sed 's/.*= "\(.*\)".*/\1/') NAME=${DESCRIPTION:-$NAME} @@ -162,7 +163,10 @@ sed 's/.*= "\(.*\)".*/\1/') else print_format "$LONG_FORMAT" print_format "$SHORT_FORMAT" - echo "$COLOR" + # I added this only to print "custom color" when muted. + if [[ $MUTED =~ "yes" ]] ; then + echo "$COLOR" + fi fi } -- cgit v1.2.3-70-g09d2