Upload files to "sunsetter"

This commit is contained in:
Kitten (like a small cat.) 2025-08-30 21:57:04 +00:00
parent 89d8a6e17d
commit c720625370
2 changed files with 172 additions and 0 deletions

37
sunsetter/sun-init Normal file
View file

@ -0,0 +1,37 @@
#!/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

135
sunsetter/sunsetter Normal file
View file

@ -0,0 +1,135 @@
#!/bin/bash
# set -x
controller() {
exec basuctl --user -- set-property rs.wl-gammarelay / rs.wl.gammarelay Temperature q "$TEMP" &
exec basuctl --user -- set-property rs.wl-gammarelay / rs.wl.gammarelay Gamma d "$GAMMA" &
exec brillo -S "$LIGHT"
}
# controllerTemp() {
# exec basuctl --user -- set-property rs.wl-gammarelay / rs.wl.gammarelay Temperature q "$TEMP"
# }
# controllerGamma() {
# exec basuctl --user -- set-property rs.wl-gammarelay rs.wl.gammarelay Gamma d "$GAMMA"
# }
# controllerLight() {
# exec brillo -S "$LIGHT"
# }
workTime() {
local TEMP="6500"
local GAMMA="1"
local LIGHT="100"
# WORKOPT="-w, --work\t Temp $TEMP K, Gamma $GAMMA, Backlight $TEMP"
controller
}
dayTime() {
local TEMP="5800"
local GAMMA="1.0"
local LIGHT="90"
# DAYOPT=printf "-d, --day \t Temp $TEMP K, Gamma $GAMMA, Backlight $TEMP % 09:45 AM"
controller
}
eveningTime() {
local TEMP="5200"
local GAMMA="1.10"
local LIGHT="80"
# EVENOPT="-e, --evening \t Temp $TEMP K, Gamma $GAMMA, Backlight $TEMP % 07:00 PM"
controller
}
nightTime() {
local TEMP="4500"
local GAMMA="1.10"
local LIGHT="80"
# NIGHTOPT="-n, --night \t Temp $TEMP K, Gamma $GAMMA, Backlight $TEMP % 09:00 PM"
controller
}
lateTime() {
local TEMP="4100"
local GAMMA="1.20"
local LIGHT="60"
# LATEOPT="-l, --late \t Temp $TEMP K, Gamma $GAMMA, Backlight $TEMP % 12:00 AM"
controller
}
bedTime() {
local TEMP="3400"
local GAMMA="1.40"
local LIGHT="10"
# BEDOPT="-b, --bed \t Temp $TEMP K, Gamma $GAMMA, Backlight $TEMP % 03:00 AM"
controller
}
# export OPTIONS=$(echo -e
# $WORKOPT
# $DAYOPT
# $EVENOPT
# $NIGHTOPT
# $LATEOPT
# $BEDOPT
# )
export OPTIONS=$(echo -e '
-w, --work\t Temp 6500K, Gamma 1.00, Backlight 100% Ad-Hoc
-d, --day \t Temp 5800K, Gamma 1.00, Backlight 90% 09:45 AM
-e, --evening \t Temp 5200K, Gamma 1.10, Backlight 80% 07:30 PM
-n, --night \t Temp 4500K, Gamma 1.10, Backlight 80% 08:00 PM
-l, --late \t Temp 4100K, Gamma 1.20, Backlight 60% 12:00 AM
-b, --bed \t Temp 3400K, Gamma 1.40, Backlight 10% 03:00 AM
')
case "$1" in
-w|--work)
exec notify-send -t 800 "Work Mode" &
workTime
;;
-d|--day)
exec notify-send -t 800 "Day Mode" &
dayTime
;;
-e|--evening)
exec notify-send -t 800 "Evening Mode" &
eveningTime
;;
-n|--night)
exec notify-send -t 800 "Night Mode" &
nightTime
;;
-l|--late)
exec notify-send -t 800 "Late Mode" &
lateTime
;;
-b|--bed)
exec notify-send -t 800 "GO TO SLEEP" &
bedTime
;;
--help)
echo -e "
SUNSETTER is a bash script that aims to emulate the automation of wlsunset
using a case script called sun-init for use with wl-gammarelay-rs, brillo,
heliocron, sunwait and basuctl instead of busctl especially for Void Linux.
Usage: sunsetter [OPTION]
Default Options and Time Suggestions:
$OPTIONS
"
;;
-h|*)
echo -e "$OPTIONS"
;;
esac
# set +x