#!/bin/bash

sunrise=$(wlsunset_info --sunrise)
sunset=$(wlsunset_info --sunset)

# sleep .1

if pgrep -x "wlsunset" > /dev/null
then
    state="an"
else
    state="aus"
fi

# check if temperature is set, so blue light filter is active
# if there's a line in the logs, than it's active
# example line:
# setting temperature on output '49' to 4771 K

[[ $sunrise == "" ]] && echo "󰹏" && echo "6500K" && exit 
[[ $state == "aus" ]] && echo "󰹏" && echo "$sunrise - $sunset - 6500K" && exit


# todo: if temperature is below 6500K 


[[ $state == "an" ]] && \
    temperature=$(cat /tmp/wlsunset.log | awk '/temperature/ {print $4}' | tail -n1) && \
    [[ $temperature == "" ]] && echo "󱩌" && exit || echo "󰤄" && echo "$sunrise - $sunset - $temperature"K    # echo "󱩌  󰹏   󰤄     󱩍   󰹐"


# 󱩌
# 󱩌
# 󰹏
# 󱩍
# 
# ⏾
# 󰤄
# 
# 
# 
# 󰛨
# 󱩎
# 󱩏
# 󱩐
# 󱩑
# 󱩒
# 󱩔
# 󱩕
# 󱩖
# 󰛩
