Some years ago, while reading Mark Sisson’s health advice, I found out (directly) about f.lux software. It changes the screen’s color temperature (blue) from my system’s daytime usage into a color temperature more sleep conducive (red) for nighttime usage. At night, red color temperature (a warm color) does not block, maybe even facilitates, melatonin production while blue light (a cool color) suppresses it. Blue color temperature is normal for electronic screens like monitors and TVs. The brain interprets that color as Wake Up!
Since then, redshift, an open source version of the same idea for Linux, came out. Preferring to use open source whenever possible, I tried redshift, but I didn’t like the way it worked on my Linux system compared with xflux, the Linux variant (f.lux is the Windows version). All I wanted was my system’s color temp to change at the appropriate time, no other fancy options or GUI required, unlike redshift‘s author’s preference. So, I stuck with the Linux version, xflux, even though it is not open source. They say they’ve got a GUI for Linux now, but I don’t want one. I don’t need to monitor it and I don’t change it often.
Assuming most Linux users work with 64-bit CPUs, download their 64-bit version although they have a 32-bit version if necessary. The download is a gzip’d tar(1) file (xflux64.tgz) that hasn’t changed since 2013. It downloads quickly and at 336KiB only contains the executable. The following command shows the archive file’s contents:
$ tar -tvzf xflux64.tgz
-rwxrwxr-x mike/mike 706004 2013-09-26 16:42 xflux
$ ls -oh xflux
-rwxrwxr-x 1 user 690K Sep 26 2013 xflux
This file is the Linux executable binary. You can prove that using the command:
$ file xflux
xflux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, BuildID[sha1]=546afa8b6a16c78da97eef00b561adbfed80721f, not stripped
While you may put the executable into your home’s bin directory (~/bin), already on your path, you don’t need to. Make the following described launcher file point to its full path, wherever you put it.
Set to Always Run (Linux & Qubes)
Make your system automatically run xflux when you login. Set this up in your home dir’s autostart directory, ~/.config/autostart on Fedora.
$ ls -oh .config/autostart/xflux.desktop
-rw-rw-r--. 1 lreznick 234 Jun 8 2015 xflux.desktop
Note: Desktop file format is a Freedesktop standard used by many GUIs to describe how applications launch in a GUI environment.
Setup xflux as follows:
Exec=/home/lreznick/bin/xflux -z XXXXX
#Exec=/home/lreznick/bin/xflux -z YYYYY
Comment[en_US]=Adjust screen temp color
Comment=Adjust screen temp color
Exec line has the full path to the xflux program and its command line arguments. Don’t forget to change the pathname to use your own path, not mine. Its only argument is the
-z option, which identifies the zip code where my system is located. Replace the
XXXXX with your own five-digit zip.
The commented out
#Exec line holds another zip
YYYYY that I travel to from time to time. Before I travel, I edit this file, comment out the
Exec line by putting a
# in front of it, delete the
# from the
#Exec line to uncomment it, and save the result. Next time I login, xflux will use my new location’s solar time. Change it back before returning from the trip. Travel to several far flung places frequently? Have as many commented out zips ready to go as you need.
Installing on Qubes
On Qubes, this desktop file goes in the same ~/.config/autostart/ directory, but on dom0. Putting anything on dom0 can be a security issue, so be sure that the xflux program — the binary — has not been compromised. If you are satisfied with its security, install from the AppVM where you downloaded and checked it onto dom0 by running:
$ qvm-run --passio APPVM 'cat APPVMPATHNAME' >DOM0PATHNAME
This command copies the bytes from the AppVM where you store the xflux program file to dom0. Substitute
APPVM with the actual AppVM’s name in the command line. On dom0, the cat(1) command inside the apostrophes will run on that AppVM. Substitute
APPVMPATHNAME with the full path to the xflux file and substitute the
DOM0PATHNAME with the full path where you want to put the xflux file. The AppVM given by
APPVM passes the bytes back to dom0 and they’re redirected to the
DOM0PATHNAME. The file still exists on your AppVM after the cat command transferred the bytes.
Now that it’s on your dom0, set the
Exec pathname in the xflux.desktop file. Next time you login, xflux will change the color temperature automatically according to your local daytime and nighttime.