diff --git a/bin/sway_volume b/bin/sway_volume index 644f24d..0ab9fbd 100755 --- a/bin/sway_volume +++ b/bin/sway_volume @@ -8,7 +8,6 @@ VOL1="●" # echo -e '\u25cc' VOL2="◌" - function getProgressString() { ITEMS="$1" # The total number of items(the width of the bar) FILLED_ITEM="$2" # The look of a filled item @@ -24,6 +23,7 @@ function getProgressString() { msg=${msg}$(printf "%${NOT_FILLED_ITEMS}s" | sed "s| |${NOT_FILLED_ITEM}|g") echo "$msg" } + function notify() { VOLUME=$(pactl list sinks | grep "Name: $SINK" -A 8 | grep -oE '[0-9]*%' | head -n 1 | sed 's/%//') MUTE=$(pactl list sinks | grep "Name: $SINK" -A 8 | grep 'Mute:' | cut -d " " -f 2) @@ -36,15 +36,15 @@ function notify() { ICON=$ICON_PATH/audio-volume-muted.svg TITLE="${VOLUME}%" elif [ $VOLUME -le 33 ]; then - ICON=$ICON_PATH/audio-volume-low.svg - TITLE="${VOLUME}%" - elif [ $VOLUME -le 67 ]; then - ICON=$ICON_PATH/audio-volume-medium.svg - TITLE="${VOLUME}%" - else - ICON=$ICON_PATH/audio-volume-high.svg + ICON=$ICON_PATH/audio-volume-low.svg TITLE="${VOLUME}%" -fi + elif [ $VOLUME -le 67 ]; then + ICON=$ICON_PATH/audio-volume-medium.svg + TITLE="${VOLUME}%" + else + ICON=$ICON_PATH/audio-volume-high.svg + TITLE="${VOLUME}%" + fi # $NOTIFY_APP -i $ICON -a "Volume" "$TEXT" $NOTIFY_APP -i $ICON "$TITLE" "$(getProgressString 10 "$VOL1" "$VOL2" $VOLUME)" }