Install, Configure, and Autostart Redshift on Qubes 4.0

09 Sep 2020
qubes logo + redshift logo

Redshift is a useful tool to combat computer screen blue light from interrupting your sleep cycle. As someone who has problems with sleep, redshift is a life saver, and it would be hard for me to use a computer without it.

Usually redshift is pretty easy to use however dom0 has no networking for (good) security reasons which means that redshift cannot use geolocation to figure out what light levels it should be set at.

All of the following commands and files will be in dom0. The below configs should be entered directly into dom0. It is possible to copy to dom0 however it is not recommended.


Installation

Redshift will need to be installed into dom0.

To open a dom0 terminal hit Alt+F1, scroll down twice to Terminal Emulator and hit enter.

Install the redshift package into dom0 with the command sudo qubes-dom0-update redshift.


Usage

You will need to find your latitude and longitude because dom0 does not have networking.

For example, go to http://www.get-direction.com/address-to-lat-long.html without a vpn and copy the decimal degrees section.

In this example we will use 39.579732:-105.01932

Test out your lat:lon with in a dom0 terminal:

redshift -l 39.579732:-105.01932

Configuration

You can configure redshift via a file for persistent use.

Place:

[redshift]
location-provider=manual
[manual]
lat=39.579732
lon=-105.01932

At /usr/local/etc/redshift.conf via your favorite text editor in dom0 as the root user.

Example:

sudo nano /usr/local/etc/redshift.conf
Write your text
Hit Ctrl-X and then Y and enter

Test your configuration again by running redshift with:

redshift -c /usr/local/etc/redshift.conf

Autostart

To make redshift start, we will make use of XDG autostart which xfce supports.

In a dom0 terminal create the autostart directory and make the file we will write to executable in the default user:

mkdir ~/.config/autostart
touch ~/.config/autostart/redshift.desktop
chmod +x ~/.config/autostart/redshift.desktop

In ~/.config/autostart/redshift.desktop write:

[Desktop Entry]
Type=Application
Name=redshift
Exec=redshift -c /usr/local/etc/redshift.conf

Note

Since redshift depends on Xorg, systemd service files will not work, which is why we use the xdg autostart desktop config

Redshift should now autostart after boot.


Timezone

Your computer's clock needs to be set correctly for redshift to properly work.

Check that your clock is working correctly by entering timedatectl into a dom0 terminal. The output looks like this:

[myuser@dom0 ~]$ timedatectl
      Local time: Mon 2020-10-05 11:02:47 MDT
  Universal time: Mon 2020-10-05 17:02:47 UTC
        RTC time: Mon 2020-10-05 17:02:47
       Time zone: America/Denver (MDT, -0600)
 Network time on: no
NTP synchronized: no
 RTC in local TZ: no

If the local time does no match your time, follow the steps below to set it.

To set the timezone, first find a country/city pair matching your timezone with the following command:

timedatectl list-timezones

The following example sets the timezone for the Mountain Time Zone:

sudo timedatectl set-timezone 'America/Denver'