Redshift: Difference between revisions

From NixOS Wiki
imported>Garbas
mNo edit summary
imported>Feliix42
Add note about redshift itself and add note that explains how redshift can silently fail to start when location is not found.
Line 1: Line 1:
Redshift [http://jonls.dk/redshift/ project page] 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 ==
== 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:
You can either manually configure a location or specify a location provider such as geoclue2 with the following options:


Line 39: Line 42:
~/.config/systemd/user/default.target.wants/redshift.service
~/.config/systemd/user/default.target.wants/redshift.service
</syntaxHighlight>
</syntaxHighlight>
After starting the service, make sure to check its status in the service manager:
<syntaxHighlight lang="shell">
systemctl --user status redshift
</syntaxHighlight>
It may happen that redshift gets stuck at ''"Waiting for initial location to become available..."'' when using the {{Ic|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.

Revision as of 16:45, 12 November 2020

Redshift project page 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, ... }: {
  ...
  # 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.