FreeBSD and RedShift – Blue Light Suppression

FreeBSD and Redshift:

Recently, I started using FreeBSD as my daily driver on my ThinkPad T480.  Rather than bore you with installing and initially configuring FreeBSD, I rather focus on the small things that will make your experience much better using FreeBSD on the desktop.

Redshift:

Redshift is an open source project designed to adjust the color temperature of your monitor according to the time of day of your locale.  During the day, the color temperature should have more blue light and, as the day progresses to night, it transitions to warmer red light.  The purpose is to reduce eye fatigue and keep your circadian clock in check if working late hours on your computer.

Installing Redshift:

To install Redshift on FreeBSD via the pkg method:

# pkg install redshift

Configuring Redshift:

Redshift configuration file can be configured but first, you must created it manually in the following directory: ~/.config/redshift.conf

; Global settings for redshift
[redshift]
; Set the day and night screen temperatures
temp-day=5700
temp-night=3500

; Enable/Disable a smooth transition between day and night
; 0 will cause a direct change from day to night screen temperature.
; 1 will gradually increase or decrease the screen temperature.
transition=1

; Set the screen brightness. Default is 1.0.
;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
; Set the screen gamma (for all colors, or each color channel
; individually)
gamma=0.8
;gamma=0.8:0.7:0.8
; This can also be set individually for day and night since
; version 1.10.
;gamma-day=0.8:0.7:0.8
;gamma-night=0.6

; Set the location-provider: 'geoclue', 'geoclue2', 'manual'
; type 'redshift -l list' to see possible values.
; The location provider settings are in a different section.
location-provider=geoclue2

; Set the adjustment-method: 'randr', 'vidmode'
; 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.
; 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'
; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
; are negative numbers.
; [manual]
; lat=48.1
; lon=11.6

; 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 screen 1.
; Note that the numbering starts from 0, so this is actually the
; second screen. If this option is not specified, Redshift will try
; to adjust _all_ screens.
; [randr]
; screen=1

Just a few notes.  Please read carefully the redshift.conf file above.  There are important clues to find the preferred location provider (redshift -l list) as well as the adjustment method (redshift -m list).  Also, the above configuration is only applicable to the specific user’s home directory which contains the ~/.config/redshift.conf file.

Configuring geoclue:

Installing Redshift also installs a related pkg – geoclue.  Geoclue is a D-Bus service that provides location information.  Although not required to use geoclue for location data, it is useful if one travels in order to keep the timing of the color transition of your monitor correctly aligned with your locale.

In order to allow Redshift to use geoclue, add the following lines to /usr/local/etc/geoclue/geoclue.conf:

[redshift]
allowed=true
system=false
users=

Command line arguments:

Redshift contains several command line arguments:

For ‘help’:

# redshift -h
Usage: redshift -l LAT:LON -t DAY:NIGHT [OPTIONS...]

Set color temperature of display according to time of day.

  -h		Display this help message
  -v		Verbose output
  -V		Show program version

  -b DAY:NIGHT	Screen brightness to apply (between 0.1 and 1.0)
  -c FILE	Load settings from specified configuration file
  -g R:G:B	Additional gamma correction to apply
  -l LAT:LON	Your current location
  -l PROVIDER	Select provider for automatic location updates
  		(Type `list' to see available providers)
  -m METHOD	Method to use to set color temperature
  		(Type `list' to see available methods)
  -o		One shot mode (do not continuously adjust color temperature)
  -O TEMP	One shot manual mode (set color temperature)
  -p		Print mode (only print parameters and exit)
  -P		Reset existing gamma ramps before applying new color effect
  -x		Reset mode (remove adjustment from screen)
  -r		Disable fading between color temperatures
  -t DAY:NIGHT	Color temperature to set at daytime/night

The neutral temperature is 6500K. Using this value will not change the color temperature of the display. Setting the color temperature to a value higher than this results in more blue light, and setting a lower value will result in more red light.

Default values:

  Daytime temperature: 6500K
  Night temperature: 4500K

Please report bugs to <https://github.com/jonls/redshift/issues>

To print parameters then exit:

# redshift -p
Waiting for current location to become available...
Location: 29.94 N, 90.03 W
Period: Daytime
Color temperature: 5700K
Brightness: 0.90

Post Install Notes:

The “user” on my system is a member of the ‘operator’ and ‘video’ groups.  The preceding information was not tested with any other users on my system so your mileage may vary depending on which groups your user belongs to.

Additionally, if you execute “redshift -p” via the command line every 5 minutes as either daylight or nighttime is approaching, one can see the transition in the printed parameters.  It’s cool.  Give it a try!

Summary:

Redshift is a great tool to help mitigate the effects of fatigue and circadian disruptions.

References:

http://jonls.dk/redshift/

man redshift

Leave a Reply

Your email address will not be published.