diff --git a/modules/volume b/modules/volume index f9ba74e..f09e5a6 100755 --- a/modules/volume +++ b/modules/volume @@ -6,11 +6,11 @@ VOLUME_ON_ICON='' VOLUME_MUTED_ICON='' get_volume(){ - active_sink=$(pacmd list-sinks | awk '/* index:/{print $3}') - curStatus=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | awk '/muted/{ print $2}') - volume=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | grep 'volume:' | grep -E -v 'base volume:' | awk -F : '{print $3}' | grep -o -P '.{0,3}%'| sed s/.$// | tr -d ' ') + active_sink=$(pactl list short sinks | sed -e 's,^\([0-9][0-9]*\)[^0-9].*,\1,' | head -n 1) + curStatus=$(pactl get-sink-mute $active_sink) + volume=$(pactl get-sink-volume $active_sink | tail -n 2 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' | head -n 1) - if [ "${curStatus}" = 'yes' ] + if [ "${curStatus}" = 'Mute: yes' ] then echo "$VOLUME_MUTED_ICON $volume%" else