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.
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.
- a working BSD or GNU/Linux system
- a working X11 setup
- a POSIX-compliant /bin/sh
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.
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.
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.
At the moment, you’ll need to manually install
blueshift by copying it to convenient location in your
$PATH. I suggest
blueshift with four arguments.
- sunrise time in 24-hour format (military time)
- sunset time in 24-hour format (military time)
- daytime color temperature (in degrees Kelvin)
- nighttime color temperature (in degrees Kelvin)
The script will make the following sanity checks:
- all arguments have been provided
sctis installed and executable
- sunrise and sunset times are between 0000 and 2359
- sunset time is greater than sunrise time
- 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.
To set daytime color temperature to 6500K at 6am, and nighttime color temperature to 4500K at 6pm.
$ blueshift 0600 1800 6500 4500
- The color temperature change is abrupt; I haven’t bothered to implement a transition over time.
- Accessing the current X session from a cron job is complicated.
- It is possible to run
blueshiftwith a nighttime color temperature that’s greater than the daytime color temperature. The script will check for this and issue a warning, but you can still do this if you want to. I figure that you know what you’re doing and have your reasons.
- DONE I really should verify that X11 is running as part of the initial diagnostics.
- Write a proper manual page
- Create a port for OpenBSD so it can be installed through the package mangler.
- Ted Unangst for sct
- Smudge and Purrseus for moral support
- Catherine Gatt for putting up with me tinkering instead of writing