# Redshift

From the redshift project web page:

  Redshift adjusts the color temperature of your screen according to your surroundings. This may help your eyes hurt less if you are working in front of the screen at night. This program is inspired by f.lux [...].

The project is developed on GitHub.

## Installation

The redshift package is available in the Official repositories.

### Desktop environments

For desktop environments, the `redshift-gtk` command is installed with the redshift package. redshift-gtk provides a system tray icon for controlling redshift. redshift-gtk requires optional dependencies python-gobject, python-xdg, and librsvg available from the Official repositories. KDE users can use the kdeplasma-applets-redshift package from the AUR.

### Autostart

There are two ways to have redshift automatically started:

- Using the provided systemd service unit files (since v. 1.9 [1]): see Systemd#Using_units. Two service files are provided, `/usr/lib/systemd/user/redshift.service` and `/usr/lib/systemd/user/redshift-gtk.service`: activate only one of them depending on whether or not you want the system tray icon.
- By right-clicking the system tray icon when redshift-gtk is already launched and selecting 'Autostart'.

## Configuration

Redshift will at least need your location to start, meaning the latitude and longitude of your location. Redshift employs several routines for obtaining your location. If none of them works (e.g. none of the used helper programs is installed), you need to enter your location manually: For most places/cities an easy way is to look up the wikipedia page of that place and get the location from there (search the page for "coordinates").

### Quick start

To just get it up and running with a basic setup, issue:

     $ redshift -l LAT:LON

where LAT is the latitude and LON is the longitude of your location.

### Automatic location based on GPS

You can also use gpsd to automatically determine your GPS location and use it as an input for Redshift. Create the following script and pass `$lat` and `$lon` to `redshift -l $lat;$lon`:

    #!/bin/bash
    date
    #gpsdata=$( gpspipe -w -n 10 |   grep -m 1 lon )
    gpsdata=$( gpspipe -w | grep -m 1 TPV )
    lat=$( echo "$gpsdata"  | jsawk 'return this.lat' )
    lon=$( echo "$gpsdata"  | jsawk 'return this.lon' )
    alt=$( echo "$gpsdata"  | jsawk 'return this.alt' )
    dt=$( echo "$gpsdata" | jsawk 'return this.time' )
    echo "$dt"
    echo "You are here: $lat, $lon at $alt"

For more information, see this forums thread.

### Manual setup

Redshift reads the configuration file `~/.config/redshift.conf`, if it exists. However, Redshift does not create that configuration file, so you have to create it manually. Example for Hamburg/Germany:

    ~/.config/redshift.conf

    ; Global settings for redshift.
    [redshift]
    ; Set the color temperatures to 5500K during the day and 3500K during the night.
    ; These are the default values since version 1.9.
    temp-day=5500
    temp-night=3500

    ; Set the monitor brightness (artifical backlight) to 90%. Default is 1.0 (100%).
    ;brightness=0.9
    ; It is also possible to use different settings for day and night since version 1.8.
    ;brightness-day=0.7
    ;brightness-night=0.4

    ; Enable/Disable a smooth transition between day and night:
    ; 0 will cause a direct change from daytime settings to night settings.
    ; 1 will gradually transition between from daytime settings to night settings.
    transition=1

    ; In the development version (the 'redshift-git' package) it is possible to
    ; change the transition period. This will cause redshift to transition between
    ; daytime settings and night settings during time of the day when the sun's
    ; elevation is 3 degrees above the horizon and 6 degrees below the horizon.
    ; These are the default settings. 'elevation-low' cannot be higher than
    ; 'elevation-high', but if they are equal, there will be no transition during twilight.
    elevation-high=3.0
    elevation-low=-6.0

    ; Set the gamma correction (for all colors, or each color channel individually.)
    gamma=0.8
    ;gamma=0.8:0.7:0.8

    ; Set the location-provider: 'geoclue', 'gnome-clock' (removed since version 1.9), 'manual'.
    ; Type 'redshift -l list' to see possible values.
    ; The location provider settings are in a different section.
    location-provider=manual

    ; Set the adjustment-method: 'randr', 'vidmode', 'drm' (since version 1.9).
    ; Type 'redshift -m list' to see all possible values.
    ; 'randr' is the preferred method, 'vidmode' is an older API
    ; but works in some cases when 'randr' does not.
    ; 'drm' is used to adjust the color in the Linux console without a display server.
    ; 'drm' requires that you are a member of the 'video' group.
    ; The adjustment method settings are in a different section.
    adjustment-method=randr

    ; Configuration of the location-provider:
    ; type 'redshift -l PROVIDER:help' to see the settings
    ; ex: 'redshift -l manual:help'
    [manual]
    ; Hamburg
    lat=53.3
    lon=10.0

    ; Configuration of the adjustment-method.
    ; Type 'redshift -m METHOD:help' to see the settings.
    ; ex: 'redshift -m randr:help'
    ; In this example, randr is configured to adjust monitor 1.
    ; Note that the numbering starts from 0, so this is actually the second monitor.
    ;[randr]
    ;crtc=1
    [randr]
    crtc=0

## Troubleshooting

### redshift-gtk will not start

redshift-gtk requires optional dependencies to work correctly. To verify any missing dependencies, run `redshift-gtk` in the command line. Similar output to the following would be produced:

     Traceback (most recent call last):
       File "/usr/bin/redshift-gtk", line 26, in <module>
         from redshift_gtk.statusicon import run
       File "/usr/lib/python3.4/site-packages/redshift_gtk/statusicon.py", line 31, in <module>
         from gi.repository import Gtk, GLib
     ImportError: No module named 'gi.repository'

If this is the case, installing python-gobject, python-xdg, and librsvg from the Official repositories would solve this issue.

## See also

- Redshift website
- Redshift on launchpad

Categories:

- X Server
- Graphics
- Eye candy
- Audio/Video