Note to self: If you create a Java application and think you need DI but not AOP, then do not automatically reach for containers like Spring, CDI, Guice. Just do all construction and wiring in the standard main method.
Redshift is a little Free and Open Source tool that can reduce the blue component in the light emitted by your computer screen. By default, it does so between sunset and sunrise based on your latitude / longitude coordinates, but you can also use a permanent fixed light temperature.
The underlying idea is that too much blue light can strain your eyes, especially at night.
Permanent candle light
On Debian and derivatives like Ubuntu, the redshift command line version can be installed like this:
sudo apt-get install redshift
I personally like a “permanent candlelight” setting at all times. This simple example sets a relatively low fixed light temperature of 1800K (see man redshift for more details):
redshift -O 1800
If you like this approach, you can run this command at X session start, similar to what is shown under “Autostart after Login” below.
Or set a bash alias like this:
alias candlelight='redshift -O 1800'
To reset your screen color temperature use this command:
redshift -x
Emulating Day and Night
If you want redshift to distinguish between day and night, it is convenient to use the GUI version with a config file that specifies your latitude and longitude as shown below.
On Debian and derivatives like Ubuntu, redshift with the GTK UI can be installed like this:
sudo apt-get install redshift-gtk
You can determine your coordinates by googling for the name of your town or city, combined with the words “longitude” and “latitude”, for example for the German town of “Rodgau” this would be: https://google.com/search?q=rodgau+longitude+latitude
Note that latitudes south of equator and longitudes west of Greenwich must be specified as negative values. The following shows an example ~/.config/redshift.conf for Halifax (44.65° North, 63.58° West), with 1800K candlelight at night and a mild 3600K during the day:
Run the tool for the first time either via Start Menu – Accessories – Redshift on Debian systems, or as redshift-gtk on the Linux command line.
You should then be able to see a reddish light-bulb icon in the system tray (aka “notification area”) of your desktop system. Clicking on it gives you options to temporarily disable the tool or view info about your configured geo-location and whether redshift thinks it is currently night-time. If so, you should notice a reddish screen color temperature.
Autostart after Login
To have redshift-gtk start up on every X session, add an entry to the Autostart mechanism of your desktop environment or window manager.
For XFCE on Debian, open Start Menu – Settings – Session and Startup – Application Autostart tab and add an entry like this:
Sometimes I have problems ending my internet use in time to get enough quality sleep.
So I decided to set up a schedule that automatically disables our wireless home network during certain night hours for “nights before work/school day” and slightly longer hours for “night before weekend day”. Luckily this is quite easily done with the ddwrt firmware that I run on my router.
I couldn’t use the “Radio Time Restrictions” feature under Wireless – Advanced Settings, because it only supports one uniform schedule for all days of the week. Instead I used ddwrt’s cron support and the wl command.
I configured the following entries under Administration – Management – Cron. This turns on the wireless every morning at 6am, shuts it down at 10:30pm on Sunday to Thursday and shuts it down at 11:45pm on Friday and Saturday:
00 06 * * * root wl radio on
30 22 * * 0-4 root wl radio off
45 23 * * 5-6 root wl radio off