0

You can type, e.g. redshift -O 4000, in terminal to set temperature to 4000 exactly but sometimes you want to adjust the colour slightly in either direction once it has been set at a value

lmb
  • 101

1 Answers1

1

I had the same question last night, and since no one has answered this, here is a script I wrote. I haven't written a shell script for years, and this is my first ever post, so may need improvement. If you set the plus/increment script as start up, and stop redshift auto starting, this will allow you to attach the below scripts to a hot key.

#!/bin/bash
#Increase temperature
maxNum=2700
incNum=135
FILE="redshift_settings"
FILELOCATION="$(dirname "$(realpath "$0")")/$FILE"
if [ ! -f "$FILELOCATION" ]; then
    echo "File does not exist, creating"
    touch "$FILELOCATION"
    echo "$maxNum" > "$FILELOCATION"
fi
rsTemp=$(head -n 1 $FILELOCATION)
if [[ $rsTemp -lt $maxNum ]]; then
    let "rsTemp += incNum";
    redshift -O $rsTemp
    echo "$rsTemp" > "$FILELOCATION"
fi
exit 0
#!/bin/bash
#Decrease temperature
maxNum=2700
decNum=135;
FILE="redshift_settings"
FILELOCATION="$(dirname "$(realpath "$0")")/$FILE"
if [ ! -f "$FILELOCATION" ]; then
    echo "File does not exist, creating"
    touch "$FILELOCATION"
    echo "$maxNum" > "$FILELOCATION"
fi
rsTemp=$(head -n 1 $FILELOCATION)
if [[ $rsTemp -gt 1000 ]]; then
    let "rsTemp -= decNum";
    redshift -O $rsTemp
    echo "$rsTemp" > "$FILELOCATION"
fi
exit 0
Zanna
  • 70,465