#!/usr/bin/env bash
# Night light (wlsunset) status / toggle.
# Matches the args used in the niri config.kdl autostart.
ARGS="-l 47 -L 8.3 -d 600 -t 4000 -T 6500"

case "${1:-toggle}" in
  status)
    pgrep -x wlsunset >/dev/null && echo true || echo false
    ;;
  toggle)
    if pgrep -x wlsunset >/dev/null; then
      pkill -x wlsunset
    else
      # shellcheck disable=SC2086
      setsid wlsunset $ARGS >/dev/null 2>&1 &
    fi
    ;;
esac
