Redshift

From NixOS Wiki
Revision as of 13:06, 17 December 2022 by imported>Onny

Redshift is a program that adjusts the color temperature of your screen according to your surroundings. By reducing the amount of blue light emitted it may help to reduce strain on the eyes if working in front of the screen at night. It's functionality is similar to f.lux.

Prerequisites

To properly work, Redshift needs your location to know when the sun will be setting and it gets dark outside, so that it can automatically adjust your screen temperature accordingly. You can either manually configure a location or specify a location provider such as geoclue2 with the following options:

Installation

Enable services.redshift. Example snippet of configuration.nix:

  ...
{ config, pkgs, callPackage, ... }: {
  ...
  # location.provider = "geoclue2"
  # All values except 'enable' are optional.
  services.redshift = {
    enable = true;
    brightness = {
      # Note the string values below.
      day = "1";
      night = "1";
    };
    temperature = {
      day = 5500;
      night = 3700;
    };
  };
};

Usage

If services.redshift.enable is true, the systemd unit redshift.service is provided. It can either be started by the user level service manager like this:

systemctl --user start redshift

Or permanantly enabled by creating the empty file

~/.config/systemd/user/default.target.wants/redshift.service

After starting the service, make sure to check its status in the service manager:

systemctl --user status redshift

It may happen that redshift gets stuck at "Waiting for initial location to become available..." when using the geoclue2 location provider. This may happen when geoclue is unable to determine your location due to missing information. In that case, you may resort to setting the location manually.

See also

  • Gammastep, alternative implementation supporting Wayland compositors