Use sunwait in your crontab to wait until sunset and then run hsetroot to change your desktop.

Crontab example:

0 16 * * * sunwait wait set; hsetroot -solid "#000000"

Configure and Make Sunwait

git clone https://github.com/risacher/sunwait

Now edit sunwait.h and replace the default latitude and longitude with whatever your location is.

North is positive; South, negative. West is negative; East, positive. For some reason sites always assume you know this and most sites will just tell you ‘N’ or ‘W’, while the program needs positive and/or negative numbers.

All you have to do to make the program is run make. If you change the config file, run make clean and then make again.

Why do this?

Yeah, this is for circadian rhythm stuff. If you have a nice background image with a lot of blue in it, something like redshift may not help that much. So you can easily change the background with hsetroot or by some other means so that you don’t get as much blue light.

This just in

In looking at redshift’s man page, it looks like it can actually handle hooks, so you could write a hook script for redshift and let it do this for you. But I think cron and sunwait is simpler to implement and more powerful (sunwait can wait for any arbitrary sun angle, for example).

More fun with hsetroot

You can also make a nice vertical gradient with hsetroot. The manpage isn’t particularly helpful, but try the code below and you can start to figure out how it works.

hsetroot -add "#FF0000" -add "#000000" -gradient 0