In the Part 11 of the FreeBSD Desktop series I would like to describe key components of self made custom desktop environment such as:

Window Manager

Status Bar

Task Bar

Wallpaper Handling

Application Launcher

Keyboard/Mouse Shortcuts

Locking Solution

Blue Light Spectrum Suppress

Today we will focus on the Blue Light Spectrum Suppress component. In the next series each of these components configuration would also be described along with eventual needed scripts.

You may want to check other articles in the FreeBSD Desktop series on the FreeBSD Desktop – Global Page where you will find links to all episodes of the series along with table of contents for each episode’s contents.

Latest versions of popular operating systems like Mac OS X (macOS) and Windows (or up-to-date Android based devices) already provide a feature to automatically adjusts color temperature of the screen according to your current time in your location. In short when then Sun is up the color temperature should be closer to about 5500K and when the Sun is down (evening/night) it should be around 3700K.

If You have never heard about Circadian Rhythm then check Wikipedia page for details. Basically its kind of 24 hour internal clock that is runs in the background of your brain and switches between sleepiness and alertness at regular intervals, also known as sleep/awake cycle.

Light, and especially temperature of this light, directly affects this cycle, if You use blue spectrum light when the Sun is down, then You are disrupting the Circadian Rhythm, to cite Wikipedia – “Studies have also shown that light has a direct effect on human health because of the way it influences the circadian rhythms.” and also – “Blue LED lighting suppresses melatonin production five times more than the orange-yellow high-pressure sodium (HPS) light.” If your body produces melatonin, then you become more sleepy, if something it preventing that production – like blue light spectrum – then you are not getting sleepy and Circadian Rhythm gets broken.

When You put two images side by side, one with about 3700K color temperature and one with about 5500K color temperature you will be able to spot the difference between them, but the tools that manage these temperatures make transition smooth and unwatchable, only if you kill the application in the night/evening you will be able to spot the difference.

Daily temperature.

Nightly temperature.

I know two tools that resolve that problem on X11 environment:

F.lux

Why would you want to run closed source software while You can use open source and it does the same thing? Personally I use Redshift but I want to mention F.lux here as Redshift project itself admits that their program is inspired by F.lux.

To cite the F.lux page it “makes the color of your computer’s display adapt to the time of day, warm at night and like sunlight during the day.”

While F.lux does not provide a native binary for FreeBSD it does offer such binary for Linux and as FreeBSD provides Linux Binary Compatibility its possible to use it on FreeBSD. That Linux binary of F.lux is available to download as tar archive xflux.tgz from the https://justgetflux.com/linux.html page.

Here is how it looks under FreeBSD.

% uname -mro FreeBSD 11.2-RELEASE amd64 % file ~/scripts/bin/xflux /home/vermaden/xflux: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.15, BuildID[sha1]=0b2094d4f1fd64100ceba2f61a7ff606f6f1cc8c, not stripped

To use F.lux just start it in the ~/.xinitrc or ~/.xsession file like that.

~/path/to/bin/xflux -l 33.54321 -g 11.12345 &

Of course 33.54321 is latitude and 11.12345 is longitude of your localization.

Redshift

This is the solution that I propose to use as open source blue light spectrum suppressor. To cite the project site “Redshift adjusts the color temperature of your screen according to your surroundings.”

Similarly like with the F.lux to start Redshift just put it in the ~/.xinitrc or ~/.xsession file like that.

redshift -l 33.54321:11.12345 -g 0.9 &

Like earlier 33.54321 is latitude and 11.12345 is longitude of your localization.

Difference

How one can tell the difference with or without using application that suppress blue light spectrum when the Sun is down? You will not be able to tell the difference instantly, but leave it enabled and think about that a month later.

When I did not used such app I was able to choose to stay up and do something till very late, like go to sleep at 3:00 AM for example or I could choose to ‘make good sleep’ and go to bed at about 0:00. After I started to use such application (first F.lux and lately Redshift) I become sleepy/tired at about 23:30 and its harder to stay up late. I think that my sleep become better and overall ‘attitude/awareness/energy/…’ are better now, but your millage may vary, check it for yourself.

EOF