cycling screen color tempurature throughout the day with sct and cron
sct is a great program but unfortunately has no built in automation function, so i made one.
first, make sure you have sct and cron installed. cron is preinstalled on many linux distros, you can check if it's running with service cron status
, which should return active
among other details. on linux mint, you can install sct with sudo apt install sct
.
next, create a file for the script. you can put it wherever you want, such as ~/.local/bin
or ~/Applications
. you can download this example by clicking here. 6500 is the default screen color tempurature.
export DISPLAY=:0
time=$(date +%H)
if [ $time = 00 ]
then
/usr/bin/sct 3000
fi
if [ $time = 01 ]
then
/usr/bin/sct 3000
fi
if [ $time = 02 ]
then
/usr/bin/sct 3000
fi
if [ $time = 03 ]
then
/usr/bin/sct 3000
fi
if [ $time = 04 ]
then
/usr/bin/sct 3500
fi
if [ $time = 05 ]
then
/usr/bin/sct 3500
fi
if [ $time = 06 ]
then
/usr/bin/sct 4000
fi
if [ $time = 07 ]
then
/usr/bin/sct 4500
fi
if [ $time = 08 ]
then
/usr/bin/sct 5000
fi
if [ $time = 09 ]
then
/usr/bin/sct 5500
fi
if [ $time = 10 ]
then
/usr/bin/sct 6000
fi
if [ $time = 11 ]
then
/usr/bin/sct 6000
fi
if [ $time = 12 ]
then
/usr/bin/sct 6500
fi
if [ $time = 13 ]
then
/usr/bin/sct 6500
fi
if [ $time = 14 ]
then
/usr/bin/sct 6500
fi
if [ $time = 15 ]
then
/usr/bin/sct 6500
fi
if [ $time = 16 ]
then
/usr/bin/sct 6000
fi
if [ $time = 17 ]
then
/usr/bin/sct 6000
fi
if [ $time = 18 ]
then
/usr/bin/sct 5500
fi
if [ $time = 19 ]
then
/usr/bin/sct 5000
fi
if [ $time = 20 ]
then
/usr/bin/sct 4500
fi
if [ $time = 21 ]
then
/usr/bin/sct 4000
fi
if [ $time = 22 ]
then
/usr/bin/sct 3500
fi
if [ $time = 23 ]
then
/usr/bin/sct 3500
fi
jumping from one setting to another can be jarring, so you could add transition animations with something like this. (i haven't as i haven't decided if i'm completely happy with this schedule yet)
then
/usr/bin/sct 3100
/usr/bin/sct 3200
sleep 0.5
/usr/bin/sct 3300
sleep 0.5
/usr/bin/sct 3400
sleep 0.5
/usr/bin/sct 3500
fi
to have this script be executed hourly, add it to your user's crontab
file. to edit it, enter:
add this text that tells cron to run it at the first minute of every hour, then save the file:
it may also be wise to have an xfce panel launcher with this script in case you start using your computer away from the top of the hour, and with different sct tempuratures for greater control.