https://wiki.archlinux.org/api.php?action=feedcontributions&user=Jumper149&feedformat=atomArchWiki - User contributions [en]2024-03-29T06:49:59ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Redshift&diff=562319Redshift2019-01-08T01:27:46Z<p>Jumper149: /* See also */ added blugon (another blue light filter/similar to redshift)</p>
<hr />
<div>[[Category:X server]]<br />
[[Category:Eye candy]]<br />
[[ja:Redshift]]<br />
[[ru:Redshift]]<br />
From the [http://jonls.dk/redshift/ Redshift project web page]:<br />
<br />
:[[Wikipedia:Redshift (software)|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 [http://justgetflux.com f.lux].<br />
<br />
{{Note| <br />
* Redshift does not support [[Wayland]] since it offers no way to adjust the color temperature [https://github.com/jonls/redshift/issues/55]. However, there is a patched version available in the AUR: {{AUR|redshift-wayland-git}}<br />
* [[GNOME]] provides features like Redshift out-of-the-box and has [[Wayland]] support. Enable the Night Light in Display settings.<br />
}}<br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{Pkg|redshift}} package. Alternatively, install the {{AUR|redshift-minimal}} package, for a version with minimal dependencies.<br />
<br />
=== Front ends ===<br />
<br />
The ''redshift-gtk'' command comes with the {{Pkg|redshift}} package and provides a system tray icon for controlling Redshift. See optional dependencies.<br />
<br />
Alternatives are {{AUR|redshiftgui-bin}} (GTK) and {{AUR|redshift-qt}}, {{AUR|redshiftconf}} or {{Pkg|plasma5-applets-redshift-control}} and {{AUR|plasma5-applets-redshift-control-git}} (Qt).<br />
<br />
== Usage ==<br />
<br />
Redshift will at least need your location to start (unless {{ic|-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.<br />
<br />
=== Quick start ===<br />
<br />
To just get it up and running with a basic setup, issue:<br />
<br />
$ redshift -l ''LATITUDE'':''LONGITUDE''<br />
<br />
where ''LATITUDE'' is the latitude and ''LONGITUDE'' is the longitude of your location.<br />
<br />
{{Tip|You can get the coordinates of a place with [http://www.geonames.org/ GeoNames.org].}}<br />
<br />
To instantly adjusts the color temperature of your screen use:<br />
<br />
$ redshift -P -O ''TEMPERATURE''<br />
<br />
where ''TEMPERATURE'' is the desired color temperature (between {{ic|1000}} and {{ic|25000}}).<br />
<br />
=== Autostart ===<br />
<br />
There are several options to have redshift automatically started:<br />
<br />
* By using a [[Systemd#Using units|systemd user unit]]. Two services are provided: {{ic|redshift.service}} and {{ic|redshift-gtk.service}}. Activate only one of them depending on whether or not you want the system tray icon.<br />
* By right-clicking the system tray icon when ''redshift-gtk'' or ''plasma5-applets-redshift-control'' is already launched and selecting ''Autostart''.<br />
* By placing a Redshift [[Desktop entry]] in {{Ic|~/.config/autostart}} or by adding {{ic|redshift&}} to your window manager or desktop environment's [[Autostarting]] method. <br />
<br />
{{Note|The Redshift service files contain {{ic|1=Restart=always}} so they will restart infinitely. See {{man|5|systemd.service}}.}}<br />
<br />
== Configuration ==<br />
<br />
Redshift reads the configuration file {{ic|~/.config/redshift/redshift.conf}}, if it exists. However, Redshift does not create that configuration file, so you may want to create it manually. See [https://raw.githubusercontent.com/jonls/redshift/master/redshift.conf.sample redshift.conf.sample].<br />
<br />
=== Automatic location based on GeoClue2 ===<br />
<br />
In order to allow access Redshift to use GeoClue2, add the following lines to {{ic|/etc/geoclue/geoclue.conf}}:<br />
<br />
{{hc|/etc/geoclue/geoclue.conf|2=<br />
[redshift]<br />
allowed=true<br />
system=false<br />
users=<br />
}}<br />
<br />
[[Restart]] {{ic|redshift.service}} and/or any other Redshift instance to apply the changes.<br />
<br />
{{Note|<br />
* This workaround is not needed with Geoclue2 version 2.5.0 and above.<br />
* If using [[GNOME]], also toggle Location Services to "On" in ''Settings > Privacy''.<br />
* Due possible bugs with geoclue2 and Redshift [https://github.com/jonls/redshift/issues/318], it may be required to use the {{ic|manual}} location-provider instead, e.g. for Paris:<br />
<br />
{{hc|~/.config/redshift/redshift.conf|2=<br />
[redshift]<br />
...<br />
; Set the location-provider: 'geoclue2', 'manual'<br />
; type 'redshift -l list' to see possible values.<br />
; The location provider settings are in a different section.<br />
location-provider=manual<br />
<br />
...<br />
<br />
; Keep in mind that longitudes west of Greenwich (e.g. the Americas)<br />
; are negative numbers.<br />
[manual]<br />
lat=48.853<br />
lon=2.349<br />
}}<br />
<br />
* If using [[i3wm]] or similar, you will also need to enable the geoclue agent on startup. As well as {{ic|systemctl --user enable redshift-gtk}} or {{ic|redshift}} user service.<br />
<br />
{{hc|~/.i3/config|2=<br />
...<br />
exec --no-startup-id /usr/lib/geoclue-2.0/demos/agent<br />
...}}<br />
}}<br />
<br />
=== Automatic location based on GPS ===<br />
<br />
You can also use {{Pkg|gpsd}} to automatically determine your [[GPS]] location and use it as an input for Redshift. Create the following script and pass {{ic|$lat}} and {{ic|$lon}} to {{ic|redshift -l $lat;$lon}}:<br />
<br />
#!/bin/bash<br />
date<br />
#gpsdata=$( gpspipe -w -n 10 | grep -m 1 lon )<br />
gpsdata=$( gpspipe -w | grep -m 1 TPV )<br />
lat=$( echo "$gpsdata" | jsawk 'return this.lat' )<br />
lon=$( echo "$gpsdata" | jsawk 'return this.lon' )<br />
alt=$( echo "$gpsdata" | jsawk 'return this.alt' )<br />
dt=$( echo "$gpsdata" | jsawk 'return this.time' )<br />
echo "$dt"<br />
echo "You are here: $lat, $lon at $alt"<br />
<br />
For more information, see [https://bbs.archlinux.org/viewtopic.php?pid=1389735#p1389735 this] forums thread.<br />
<br />
=== Use real screen brightness ===<br />
<br />
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. [http://jonls.dk/redshift/#known-bugs-and-limitations]<br />
<br />
Changing screen backlight is possible with redshift hooks and {{pkg|xorg-xrandr}} and {{pkg|xorg-xbacklight}} 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.<br />
<br />
You need to create a file in {{ic|~/.config/redshift/hooks}} and make it executable. You can use and edit the following example:<br />
<br />
$ mkdir -p ~/.config/redshift/hooks<br />
<br />
Create and adjust the following script:<br />
<br />
{{hc|~/.config/redshift/hooks/brightness.sh|output=<br />
#!/bin/sh<br />
<br />
# Set brightness via xbrightness when redshift status changes<br />
<br />
# Set brightness values for each status.<br />
# Range from 1 to 100 is valid<br />
brightness_day=100<br />
brightness_transition=50<br />
brightness_night=10<br />
# Set fade time for changes to one minute<br />
fade_time=60000<br />
<br />
if [ "$1" = period-changed ]; then<br />
case $3 in<br />
night)<br />
xbacklight -set $brightness_night -time $fade_time<br />
;;<br />
transition)<br />
xbacklight -set $brightness_transition -time $fade_time<br />
;;<br />
daytime)<br />
xbacklight -set $brightness_day -time $fade_time<br />
;;<br />
esac<br />
fi<br />
}}<br />
<br />
Make it [[executable]]:<br />
<br />
$ chmod +x ~/.config/redshift/hooks/brightness.sh<br />
<br />
[[Restart]] the {{ic|redshift.service}} to apply changes.<br />
<br />
Check the service status as it should '''not''' contain the following message:<br />
<br />
redshift[..]: No outputs have backlight property<br />
<br />
== Troubleshooting ==<br />
<br />
=== Screen 1 could not be found ===<br />
<br />
Locate configuration-file "redshift.conf" in your distribution and change "screen 1" to "screen 0".<br />
<br />
=== Left/right clicking the tray icon does not work ===<br />
<br />
Install {{Pkg|libappindicator-gtk3}}. See [https://github.com/jonls/redshift/issues/363 redshift issue 363] and {{Bug|49971}}.<br />
<br />
=== Redshift makes the screen quickly flicker between the set color value of the screen and the default color value ===<br />
<br />
Make sure there are not multiple instances of redshift running.<br />
<br />
=== Redshift works fine when invoked as a command but fails when run as a systemd service ===<br />
<br />
The [[systemd]] unit has a line in the {{ic|redshift.service}} file that makes the service wait until the {{ic|display-manager.service}} unit is started by a [[display manager]] before the unit will invoke {{ic|redshift}}. If you do not use a display manager, [[edit]] the {{ic|redshift.service}} user service and delete the {{ic|1=After=display-manager.service}} line. Run {{ic|systemctl --user daemon-reload}} and the service should initialize properly.<br />
<br />
=== Redshift temporarily resets using some wine apps that reset gamma values ===<br />
<br />
If you notice that using some wine apps, 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 [https://www.winehq.org/pipermail/wine-bugs/2015-January/403770.html] and [https://wiki.winehq.org/UsefulRegistryKeys]. Set or create the string value<br />
<br />
{{hc|HKEY_CURRENT_USER\Software\Wine\X11 Driver|2=<br />
UseXVidMode="N"<br />
}}<br />
<br />
using the registry editor, or import/set it otherwise.<br />
<br />
=== Redshift GDBus.Error:org.freedesktop.DBus.Error.AccessDenied on start ===<br />
<br />
If running {{ic|$ redshift}} and you are getting:<br />
<br />
{{hc|$ redshift|<br />
Trying location provider `geoclue2'...<br />
Using provider `geoclue2'.<br />
Unable to start GeoClue client: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: 'redshift' disallowed, no agent for UID 1000.<br />
Unable to connect to GeoClue.<br />
Unable to get location from provider.<br />
}}<br />
<br />
or running {{ic|$ redshift-gtk}} and getting the similar error:<br />
<br />
{{hc|$ redshift-gtk|<br />
Failed to run Redshift<br />
Trying location provider `geoclue2'...<br />
Unable to start GeoClue client:<br />
GDBus.Error:org.freedesktop.DBus.Error.AccessDenied:<br />
'redshift' disallowed, no agent for UID 1000.<br />
Unable to connect to GeoClue.<br />
Unable to get location from provider.<br />
}}<br />
<br />
You can create a [[systemd]] unit file in {{ic|~/.config/systemd/user/geoclue-agent.service}} with the following config:<br />
<br />
{{hc|~/.config/systemd/user/geoclue-agent.service|2=<br />
[Unit]<br />
Description=redshift needs to get a (geo)clue<br />
<br />
[Service]<br />
ExecStart=/usr/lib/geoclue-2.0/demos/agent<br />
<br />
[Install]<br />
WantedBy=default.target<br />
}}<br />
<br />
Start and enable the service with systemctl: {{ic|$ systemctl --user enable --now geoclue-agent.service}} and try running redshift again.<br />
<br />
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 {{ic|/etc/geoclue/geoclue.conf}} (see [https://github.com/jonls/redshift/issues/158#issuecomment-71329118 redshift issue 158] and {{Bug|40360}}) and run {{ic|$ redshift}} again:<br />
<br />
{{hc|/etc/geoclue/geoclue.conf|2=<br />
[redshift]<br />
allowed=true<br />
system=false<br />
users=<br />
}}<br />
<br />
== See also ==<br />
<br />
* [http://jonls.dk/redshift Redshift website]<br />
* [http://github.com/jonls/redshift Redshift on github]<br />
* [[Wikipedia:Redshift_(software)]]<br />
* {{AUR|blugon}} - simple Blue Light Filter [https://github.com/jumper149/blugon]<br />
* {{AUR|sct}} - set color temperature [http://www.tedunangst.com/flak/post/sct-set-color-temperature]<br />
* {{AUR|xflux-gui-git}}</div>Jumper149