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 the closed-source application f.lux.
Note: Redshift does not support Wayland . See Backlight#Wayland for alternatives.

Installation

Install the redshift package. Alternatively, install the redshift-minimalAUR package, for a version with minimal dependencies.

Front ends

The redshift-gtk command comes with the redshift package and provides a system tray icon for controlling Redshift. See optional dependencies.

Alternatives are redshiftgui-binAUR and redshift-qtAUR, redshiftconfAUR or plasma5-applets-redshift-control-gitAUR.

Usage

Redshift will at least need your location to start (unless -O is used), 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.

Quick start

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

$ redshift -l LATITUDE:LONGITUDE

where LATITUDE is the latitude and LONGITUDE is the longitude of your location.

Tip: You can get the coordinates of a place with GeoNames.org.

To instantly adjust the color temperature of your screen use:

$ redshift -P -O TEMPERATURE

where is the desired color temperature (between and ).

Autostart

There are several options to have Redshift automatically started:

  • By right-clicking the system tray icon and selecting Autostart when redshift-gtk or plasma5-applets-redshift-control is already launched.
  • By placing a Redshift desktop entry in or by adding redshift to your window manager or desktop environment's autostarting method.
  • By using the user units provided: and redshift-gtk.service. Activate only one of them depending on whether or not you want the system tray icon.

Toggle

Redshift will continously update the color temperature at regular intervals. One shot mode can be selected if you only want to do one adjustment. The color adjustments done by Redshift can be temporarily toggled on and off by sending it the USR1 signal:

$ pkill -USR1 redshift

Configuration

Redshift reads the configuration file if it exists. However, Redshift does not create that configuration file, so you may want to create it manually. See redshift.conf.sample.

Automatic location based on GeoClue2

First check if backend is working. To do this you first need to enable an agent by running and later . The agent, however, is not needed for the Redshift itself. At this time default Arch Linux API key for Mozilla services reaches limit (see SO post and bugreport) and Wi-Fi location method is banned. As workaround it is suggested to change API key to 'geoclue'.

In order to allow access Redshift to use GeoClue2, add the following lines to :

Restart and/or any other Redshift instance to apply the changes.

Note:
  • This workaround is not needed with Geoclue2 version 2.5.0 and above.
  • If using GNOME, also toggle Location Services to "On" in Settings > Privacy.
  • Due possible bugs with geoclue2 and Redshift , it may be required to use the manual location-provider instead, e.g. for Paris:
~/.config/redshift/redshift.conf
[redshift]
...
; Set the location-provider: 'geoclue2', 'manual'
; type 'redshift -l list' to see possible values.
; The location provider settings are in a different section.
location-provider=manual

...

; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
; are negative numbers.
[manual]
lat=48.864716
lon=2.349014
  • If using i3wm or similar, you will also need to enable the geoclue agent on startup. As well as the redshift-gtk.service or redshift.service user unit.
~/.i3/config
...
exec --no-startup-id /usr/lib/geoclue-2.0/demos/agent
...

Automatic location based on GPS

You can curl location data and parse it into the format required by Redshift. For example, Mozilla provides json location data that can be parsed with as follows

redshift -l $(curl -s "https://location.services.mozilla.com/v1/geolocate?key=geoclue" | jq -r '"\(.location.lat):\(.location.lng)"')

or with awk if jq is not on the system,

redshift -l $(curl -s "https://location.services.mozilla.com/v1/geolocate?key=geoclue" | awk 'OFS=":" {print $3,$5}' | tr -d ',}')

You can also use to automatically determine your GPS location and use it as an input for Redshift. Create the following script and pass $lat and to :

#!/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.

Use real screen brightness

Redshift has a brightness adjustment setting, but it does not work the way most people might expect. In fact it is a fake brightness adjustment obtained by manipulating the gamma ramps, which means that it does not reduce the backlight of the screen.

Changing screen backlight is possible with redshift hooks and , but please see Backlight#xbacklight as there are some limitations and you may have to find another method of controlling the backlight depending on your hardware.

You need to create a file in and make it executable. You can use and edit the following example:

Make it executable and restart the to apply changes.

Check the service status as it should not contain the following message:

redshift[..]: No outputs have backlight property

Troubleshooting

Screen 1 could not be found

Locate configuration-file "redshift.conf" in your distribution and change "screen 1" to "screen 0".

Left/right clicking the tray icon does not work

Install . See redshift issue 363 and .

Redshift makes the screen quickly flicker between the set color value of the screen and the default color value

Make sure there are not multiple instances of redshift running.

Redshift works fine when invoked as a command but fails when run as a systemd service

The systemd unit has a line in the file that makes the service wait until the display-manager.service unit is started by a display manager before the unit will invoke redshift. If you do not use a display manager, edit the user service and delete the line. Run a daemon-reload and the service should initialize properly.

Redshift-gtk service causes core-dumping

Refer to the previous problem and to .

Redshift does not appear in system tray

If running the command does not start in the system tray, but instead you get the following output

you will need to install .

Redshift temporarily resets using some wine applications that reset gamma values

If you notice that using some wine applications, redshift seems to reset temporarily upon launch, or adjusting settings, or etc, then there is a useful registry key that seems to alleviate this. See and . Set or create the string value

using the registry editor, or import/set it otherwise.

Redshift GDBus.Error:org.freedesktop.DBus.Error.AccessDenied on start

If running $ redshift and you are getting:

or running and getting the similar error:

You can create a systemd unit file in with the following config:

Start/enable the geoclue-agent.service user unit and try running redshift again.

If you still get the same error, it may be because of geoclue being locked down to a few programs by default. Try adding the following lines to (see redshift issue 158 and ) and run $ redshift again:

Redshift turns the screen green when resolution is over 1080p while using Nvidia drivers

This is a bug with the nvidia drivers. A fix for this is to make the following edit:

For more information, see redshift issue 587 and redshift issue 720.

Redshift does not support hotkey for toggling

A workaround is to create a custom hotkey in your desktop environment calling the command .

For more information, see .

gollark: I host heavpoot's stuff.
gollark: ... yes?
gollark: I have TONS of spare capacity.
gollark: Use osmarks.tk hosting?
gollark: &sys error Æ

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.