1
0
Fork 0
mirror of https://github.com/SinTan1729/random.git synced 2024-12-27 05:28:37 -06:00

Move high/low values to config file

This commit is contained in:
Sayantan Santra 2022-07-11 23:52:48 -05:00
parent d364655447
commit bd4f69116e

View file

@ -10,6 +10,8 @@
# latitude="0.000000N" # latitude="0.000000N"
# longitude="0.000000E" # longitude="0.000000E"
# scriptdir=<location-of-this-script> # scriptdir=<location-of-this-script>
# high=70
# low=40
# Just run this script one manually to set it up to run perpetually (hopefully) using 'at' # Just run this script one manually to set it up to run perpetually (hopefully) using 'at'
# (Some distros don't come with 'at' preinstalled, so you might need to install 'at' and enable the 'atd' service.) # (Some distros don't come with 'at' preinstalled, so you might need to install 'at' and enable the 'atd' service.)
@ -32,16 +34,16 @@ fi
if [ "$1" == "scheduler" ]; then if [ "$1" == "scheduler" ]; then
if [ $(sunwait poll $latitude $longitude) == "DAY" ]; then if [ $(sunwait poll $latitude $longitude) == "DAY" ]; then
# +1 minute is so that the next schedule is set up properly (or sunwait reports day/night in a misleading way) # +1 minute is so that the next schedule is set up properly (or sunwait reports day/night in a misleading way)
at -m $(sunwait report 35.221050N 97.445938W | grep "Daylight:" | awk '{print $6}') +1 minute <<< "ddcutil setvcp 10 40 && $scriptdir/brightness-by-daylight.sh scheduler" at -m $(sunwait report 35.221050N 97.445938W | grep "Daylight:" | awk '{print $6}') +1 minute <<< "ddcutil setvcp 10 $low && $scriptdir/brightness-by-daylight.sh scheduler"
else else
at -m $(sunwait report 35.221050N 97.445938W | grep "Daylight:" | awk '{print $4}') +1 minute <<< "ddcutil setvcp 10 70 && $scriptdir/brightness-by-daylight.sh scheduler" at -m $(sunwait report 35.221050N 97.445938W | grep "Daylight:" | awk '{print $4}') +1 minute <<< "ddcutil setvcp 10 $high && $scriptdir/brightness-by-daylight.sh scheduler"
fi fi
else else
if [ $(sunwait poll $latitude $longitude) == "DAY" ]; then if [ $(sunwait poll $latitude $longitude) == "DAY" ]; then
ddcutil setvcp 10 70 ddcutil setvcp 10 $high
echo "Monitor brightness set to 70%, since it's day time." echo "Monitor brightness set to $high%, since it's day time."
else else
ddcutil setvcp 10 40 ddcutil setvcp 10 $low
echo "Monitor brightness set to 40%, since it's night time." echo "Monitor brightness set to $low%, since it's night time."
fi fi
fi fi