Change screen from red to blue temperature color according to current time or manually.
It takes arise and sunset time and calc middle of the day. Then calc if it is going to be sunset or it is going to be arise according to current time. Color changes from middle of the day to middle of the night and reverse by hours.
At the middle of the day it makes screen blue and at the middle of the night red.
If there is a gap in day or night, then in this gap temperature stay fixed.
The idea was taken from https://github.com/jonls/redshift/ but not to help eyes, but as an experiment to make body understand current time.
This is a simple bash script that get current time and set your screen more red or blue according to current time.
This script uses “colorramp” from Redshift of jonls, which is Ingo Thies, 2013.
This script have code to calculate middle of the day and middle of the night and percentage of sun rising and sunset. You can use it for Salat or Namaz calculation for Muslims or something like that.
This script don’t change brightness but it is degrading at high blue and red.
Ninght gap = 10 hours - full RED temperature
sunset 23 00
21 x---------- arise 4 AM
---/ \--X-
-X --X
/ --\ -/ \
/ -\ --/ \
/ --\ -/ \
temper. | -o/ | temperature change
change \ |\ / from RED to BLUE
from \ / | /
BLUE \ | \ /
to -\ | | /-
RED ---\ / \ /---
---+----+--
12
day gap = 2 hours - full BLUE
This script depends on xranr https://www.x.org/wiki/Projects/XRandR/
Check that xrandr exist at PATH:
xrandrExecute script to shell:
source /home/user/git_cloned_sources/redshift/redshift.shThen call following command to get time and adjust screen:
do_redshiftTo set RED-BLUE manually call following command with value between 0 and 100
redshift 99To set display back to normal:
redshift normalTo test full circle use command:
test_do_redshiftIf at the middle of the day BLUE is too active you can decrease it with increasing value of TOO_MUCH_BLUE, same for red.
Set variables R and S inside of the script https://github.com/Anoncheg1/redshift/blob/main/redshift.sh#L586 This is time of raising and sunset. You can get this values at internet according to your region and season.
declare -i R=2 # ARAISE - 2:00 time of sun rising
declare -i S=19 # SUNSET - 19:00 time of sunset
declare -i day_gap=0 # gap in the middle of the day
declare -i night_gap=10 # gap in the middle of the night when it is always redYou can activate command when you do other frequently used commands:
alias ls="do_redshift ; ls"Or add command to Cron daemon with hour period:
sudo cron -e
# and add this line:
0 * * * * source /home/user/git_cloned_sources/redshift/redshift.sh ; do_redshift >/dev/null