blueshift

blueshift is a replacement for redshift built with POSIX shell, core utilities, and sct that I developed and tested on OpenBSD. It’s available for any OS that also supports sct under the 2-clause BSD license.

contents

download

blueshift is developed on Sourcehut. I wrote it to scratch my itch, but if it doesn’t quite scratch yours feel free to improve upon it.

You can also download blueshift here. I’ll try to keep versions synced between this site and Sourcehut, but Sourcehut is the primary source.

dependencies

use case

You should consider using blueshift if you want to run a periodic cron job and/or a acpi wakeup script (like /etc/apm/resume) to check the current time, compare it against a set of “sunrise” and “sunset” times, and set your display’s color temperature to a reasonable value to help reduce eyestrain.

Because blueshift doesn’t run as a daemon, it may be a better fit for laptop users since you can control how often it runs to check the time.

You can also do this with greater precision using redshift, but that app is heavier in terms of dependencies. It also requires a set of ICBM targeting coordinates (latitude/longitude) or permission to geolocate your external IP address.

alternatives

If you’re on OpenBSD, you may not know that the sct package also comes with a script called sctd by Aaron Bieber which works as a daemon and provides a transition over time.

installation instructions

At the moment, you’ll need to manually install blueshift by copying it to convenient location in your $PATH. I suggest ${HOME}/bin.

usage instructions

Run blueshift with four arguments.

  1. sunrise time in 24-hour format (military time)
  2. sunset time in 24-hour format (military time)
  3. daytime color temperature (in degrees Kelvin)
  4. nighttime color temperature (in degrees Kelvin)

The script will make the following sanity checks:

  1. all arguments have been provided
  2. sct is installed and executable
  3. sunrise and sunset times are between 0000 and 2359
  4. sunset time is greater than sunrise time
  5. color temperature values are between 0 and 10,000

If everything looks good, blueshift will get the current time from your system clock, compare it against the sunrise and sunset times, and run sct with the appropriate color temperature value.

example

To set daytime color temperature to 6500K at 6am, and nighttime color temperature to 4500K at 6pm.

          
            $ blueshift 0600 1800 6500 4500
                        
        

caveats

todo

credits