sway_volume: autoformat

This commit is contained in:
Konstantin Koslowski 2021-03-10 13:55:20 +01:00
parent 209195e8a9
commit f2d5c90151

View file

@ -8,7 +8,6 @@ VOL1="●"
# echo -e '\u25cc' # echo -e '\u25cc'
VOL2="◌" VOL2="◌"
function getProgressString() { function getProgressString() {
ITEMS="$1" # The total number of items(the width of the bar) ITEMS="$1" # The total number of items(the width of the bar)
FILLED_ITEM="$2" # The look of a filled item 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") msg=${msg}$(printf "%${NOT_FILLED_ITEMS}s" | sed "s| |${NOT_FILLED_ITEM}|g")
echo "$msg" echo "$msg"
} }
function notify() { function notify() {
VOLUME=$(pactl list sinks | grep "Name: $SINK" -A 8 | grep -oE '[0-9]*%' | head -n 1 | sed 's/%//') 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) 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 ICON=$ICON_PATH/audio-volume-muted.svg
TITLE="${VOLUME}%" TITLE="${VOLUME}%"
elif [ $VOLUME -le 33 ]; then elif [ $VOLUME -le 33 ]; then
ICON=$ICON_PATH/audio-volume-low.svg 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
TITLE="${VOLUME}%" 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 -a "Volume" "$TEXT"
$NOTIFY_APP -i $ICON "$TITLE" "$(getProgressString 10 "$VOL1" "$VOL2" $VOLUME)" $NOTIFY_APP -i $ICON "$TITLE" "$(getProgressString 10 "$VOL1" "$VOL2" $VOLUME)"
} }