#!/bin/sh

# The volume_change event supplies a $INFO variable in which the current volume
# percentage is passed to the script.

if [ "$SENDER" = "volume_change" ]; then
  VOLUME="$INFO"

  case "$VOLUME" in
    [6-9][0-9]|100) 
      ICON="󰕾"
      COLOR="0xff8aadf4"
    ;;
    [3-5][0-9]) 
      ICON="󰖀"
      COLOR="0xff8aadf4"
    ;;
    [1-9]|[1-2][0-9]) 
      ICON="󰕿"
      COLOR="0xffed8796"
    ;;
    *) 
      ICON="󰖁"
      COLOR="0xffed8796"
  esac

  sketchybar --set "$NAME" icon.color="$COLOR" icon="$ICON" label.color="$COLOR" label="$VOLUME%"
fi
