#!/bin/bash
source $HOME/.config/sway/bin/sway_helpers
DEVICE=sysfs/backlight/intel_backlight
NOTIFY_APP="dunstify -a brightness -h string:x-dunst-stack-tag:brightness"
ICON=$HOME/.local/share/icons/Tela-circle-dark/16/panel/xfpm-brightness-lcd.svg
APP="/usr/bin/light -s $DEVICE"
PRG1="●"
PRG2="◌"

## main
_log BRIGHTNESS INFO args: $*
_check_app $APP

case $1 in
  d*)
    $APP -U 10
    BR=$($APP)
    $NOTIFY_APP -i $ICON "$BR" "$(getProgressString 10 "$PRG1" "$PRG2" $BR)"
    ;;
  i*)
    $APP -A 10
    BR=$($APP)
    $NOTIFY_APP -i $ICON "$BR" "$(getProgressString 10 "$PRG1" "$PRG2" $BR)"
    ;;
  "-h"|"--help")
    echo "arguments: [decrease|increase]"
    ;;
  *)
    BR=$($APP)
    $NOTIFY_APP -i $ICON "$BR" "$(getProgressString 10 "$PRG1" "$PRG2" $BR)"
    ;;
esac
