What do you think? Discuss, post comments, or ask questions at the end of this article [More about me]

My eyes are a big fan of redshift.  Redshift changes your display's colour temperature to make it a lot easier on your eyes (especially in dark settings).

Now, you could install and use something like redshift-gtk, which gives you a tray application which allows you to enable/disable redshift etc.  However, on my i3wm setup, I prefer to control redshift a manually.

A few reasons for this:

  • I generally don't like extra processes and apps running;
  • I don't like tray apps in general (I don't know why... they just annoy me);
  • I like bindsym-ming stuff I use often;

Below is a quick overview of how I implement redshift with i3wm.

Guide

Install redshift

First make sure redshift is installed on your distro of choice.

For Ubuntu/Debian install with:

sudo apt install redshift

For Manjaro/Arch install with:

sudo pacman -S redshift

Modify your i3 config

We're going to add an i3 binding mode, which we will call with a bindsym ($mod+r for example).  This will show several options for controlling redshift (these options will usually show up at the bottom left of your screen).

Add the following to your i3 config file (usually at ~/.i3/config):

# redshift modes
bindsym $mod+r mode "$mode_redshift"
set $mode_redshift Set colour temperature: (a)uto, (r)eset, (2)500K, (3)000K, (4)000K, (5)000K
set $kill_redshift pkill -9 redshift;
mode "$mode_redshift" {
    bindsym a exec --no-startup-id "$kill_redshift redshift -P -t 5000:4000", mode "default"
    bindsym r exec --no-startup-id "$kill_redshift redshift -x", mode "default"
    bindsym 2 exec --no-startup-id "$kill_redshift redshift -P -O 2500", mode "default"
    bindsym 3 exec --no-startup-id "$kill_redshift redshift -P -O 3000", mode "default"
    bindsym 4 exec --no-startup-id "$kill_redshift redshift -P -O 4000", mode "default"
    bindsym 5 exec --no-startup-id "$kill_redshift redshift -P -O 5000", mode "default"

    # exit mode: "Enter" or "Escape"
    bindsym Return mode "default"
    bindsym Escape mode "default"
}


Note here that all options except (a)uto do not run redshift in memory as they use the oneshot flag (-O).  (a)uto mode simply runs the default redshift mode (which stays in memory and changes the temperature throughout the day).

Pressing $mod+r should show something like the following option in the bottom-left of your screen:

References

  1. https://en.wikipedia.org/wiki/Redshift_(software)
  2. https://i3wm.org/docs/userguide.html#binding_modes