ktns-dotfiles-2025/sunsetter/sun-init

38 lines
702 B
Plaintext
Raw Permalink Normal View History

2025-08-30 21:57:04 +00:00
#!/bin/bash
AZIMUTH="$(heliocron poll |grep Azimuth |grep -o [[:digit:]]*|head -n 1)"
case $(sunwait poll $LATLONG) in
DAY)
if
[[ $AZIMUTH -gt 100 ]]
then
sunsetter -d
else
sunsetter -b
fi
;;
NIGHT)
if
[[ $AZIMUTH -ge 270 ]] && [[ $AZIMUTH -lt 280 ]]; then
#sunset - 8 ish
sunsetter -e
elif
[[ $AZIMUTH -ge 280 ]] && [[ $AZIMUTH -lt 340 ]]; then
# 8ish to Midnightish
sunsetter -n
elif
[[ $AZIMUTH -ge 340 ]] || [[ $AZIMUTH -lt 50 ]]; then
# 12 - 3
sunsetter -l
elif
[[ $AZIMUTH -ge 50 ]]; then
sunsetter -b
#after 3
else echo PROBLEM
fi
;;
esac