a replacement for redshift built with POSIX shell, core utilities, and sct
bugfix and documentation update
Updating documentation

refs

master
browse log
v1.1.0
release notes

clone

read-only
https://git.sr.ht/~demifiend/blueshift
read/write
git@git.sr.ht:~demifiend/blueshift

You can also use your local clone with git send-email.

blueshift

a replacement for redshift built with POSIX shell, core utilities, and sct

© 2019 Matthew Graybosch mewnix@matthewgraybosch.com

released under the 2-clause BSD license

dependencies

  • a working BSD or GNU/Linux system
  • a working X11 setup
  • a POSIX-compliant /bin/sh
  • sct

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.

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.

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

  • The color temperature change is abrupt; I haven't bothered to implement a transition over time.
  • It is possible to run blueshift with 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.

todo

  • [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.

credits

  • Ted Unangst for sct
  • Smudge and Purrseus for moral support
  • Catherine Gatt for putting up with me tinkering instead of writing