#!/bin/bash

operation="${1}"
WOBSOCK="$XDG_RUNTIME_DIR/wob.sock"
source "${HOME}/.config/de-vars/colors/active/colors.sh"
opacity="BF"

case "$operation" in
  up)
#    brightnessctl set +5% | sed -En 's/.*\(([0-9]+)%\).*/\1/p'
    brighness_change="+5%"
    ;;&
  down)
#    brightnessctl set 5%- | sed -En 's/.*\(([0-9]+)%\).*/\1/p'
    brighness_change="5%-"
    ;;&
  up|down)
    light_lvl="$(brightnessctl set ${brighness_change} | sed -En 's/.*\(([0-9]+)%\).*/\1/p')"
    echo "${light_lvl}" "${de_color_0}${opacity}" "${de_color_1}${opacity}" "${de_color_3}${opacity}" > "$WOBSOCK"
    ;;
esac
