Redshift: Difference between revisions

From NixOS Wiki
imported>Onny
mNo edit summary
Layer-09 (talk | contribs)
Changed the layout, added more information
Line 1: Line 1:
[http://jonls.dk/redshift/ 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.
[http://jonls.dk/redshift/ Redshift] is an open-source software application designed to adjust the color temperature of computer displays based on the time of day. Created by Jon Lund Steffensen, Redshift modifies the color temperature to reduce eye strain and improve sleep patterns. This application aims to provide a more comfortable viewing experience by dynamically changing the display's color temperature to match the user's surrounding light conditions.


== Prerequisites ==
It does this by gradually shifting the color temperature of the display from cooler (bluer) tones during the day to warmer (redder) tones at night.


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.
Users have the flexibility to customize various settings in Redshift. They can specify custom values for day and night color temperatures, adjust the speed of color transitions, and temporarily disable or manually adjust the color temperature.
You can either manually configure a location or specify a location provider such as geoclue2 with the following options:
 
* [https://search.nixos.org/options/?query=location.provider {{ic|location.provider}}]
* [https://search.nixos.org/options/?query=location.latitude {{ic|location.latitude}}] (Used by the {{ic|manual}} provider.)
* [https://search.nixos.org/options/?query=location.longitude {{ic|location.longitude}}] (Used by the {{ic|manual}} provider.)


== Installation ==
== Installation ==


Enable <syntaxhighlight lang="nix" inline>services.redshift</syntaxhighlight>.
==== Basic ====
Example snippet of <code>configuration.nix</code>:
<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix> ...
# location.provider = "geoclue2"
{ config, pkgs, callPackage, ... }: {
# All values except 'enable' are optional.
  ...
services.redshift = {
  # location.provider = "geoclue2"
  enable = true;
  # All values except 'enable' are optional.
  temperature = {
  services.redshift = {
     day = 5500;
    enable = true;
    night = 3700;
    brightness = {
      # Note the string values below.
      day = "1";
      night = "1";
    };
     temperature = {
      day = 5500;
      night = 3700;
    };
   };
   };
};
};
</syntaxHighlight>
</syntaxHighlight>


== Usage ==
==== Advanced ====
If <syntaxhighlight lang="nix" inline>services.redshift.enable</syntaxhighlight> is true, the systemd unit <syntaxhighlight inline>redshift.service</syntaxhighlight> is provided. It can either be started by the user level service manager like this:
<syntaxHighlight lang=nix>
services.redshift = {
  enable = true;
 
  # Display temperature settings
  temperature = {
    day = 5700;
    night = 3500;
  };
 
  # Location settings (replace with your coordinates)
  latitude = "27.9880614";
  longitude = "86.92521";
 
  # Schedule settings
  settings = {
    dawn-time = "6:00-7:45";
    dusk-time = "18:35-20:15";
  };
 
  # General settings
  brightness = {
    day = "1";
    night = "0.8";
  };
 
  extraOptions = [
    "-v"
    "-m randr"
  ];
};
 
# Setting the location works either by using a provider
services.geoclue2.enable = true;
location.provider = "geoclue2";
 
# Or like this, which can also be set in services.redshift
location.latitude = "27.9880614";
location.longitude = "86.92521";
</syntaxHighlight>
 
== Tips and Tricks ==
==== Location of Options ====
The home manager options are defined in the following [https://nix-community.github.io/home-manager/options.xhtml#opt-services.gammastep.enable Home Manager Options Manual].
 
The global options are listed on [https://mynixos.com/search?q=redshift MyNixOS].
 
==== Usage ====
<syntaxHighlight lang="shell">
<syntaxHighlight lang="shell">
# 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
systemctl --user start redshift
</syntaxHighlight>
 
Or permanantly enabled by creating the empty file
# Or permanantly enabled by creating the empty file
<syntaxHighlight lang="shell">
~/.config/systemd/user/default.target.wants/redshift.service
~/.config/systemd/user/default.target.wants/redshift.service
</syntaxHighlight>


After starting the service, make sure to check its status in the service manager:
# After starting the service, make sure to check its status in the service manager:
<syntaxHighlight lang="shell">
systemctl --user status redshift
systemctl --user status redshift
</syntaxHighlight>
</syntaxHighlight>
== Troubleshooting ==
==== Provider is unable to determine location ====
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.
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.


== See also ==
== References ==
* [[Gammastep]], alternative implementation supporting Wayland compositors
* https://github.com/jonls/redshift
* https://nix-community.github.io/home-manager/options.xhtml#opt-services.gammastep.enable
* https://mynixos.com/search?q=redshift


[[Category:Applications]]
[[Category:Applications]]

Revision as of 07:36, 5 July 2024

Redshift is an open-source software application designed to adjust the color temperature of computer displays based on the time of day. Created by Jon Lund Steffensen, Redshift modifies the color temperature to reduce eye strain and improve sleep patterns. This application aims to provide a more comfortable viewing experience by dynamically changing the display's color temperature to match the user's surrounding light conditions.

It does this by gradually shifting the color temperature of the display from cooler (bluer) tones during the day to warmer (redder) tones at night.

Users have the flexibility to customize various settings in Redshift. They can specify custom values for day and night color temperatures, adjust the speed of color transitions, and temporarily disable or manually adjust the color temperature.

Installation

Basic

# location.provider = "geoclue2"
# All values except 'enable' are optional.
services.redshift = {
  enable = true;
  temperature = {
    day = 5500;
    night = 3700;
  };
};

Advanced

services.redshift = {
  enable = true;
  
  # Display temperature settings
  temperature = {
    day = 5700;
    night = 3500;
  };
  
  # Location settings (replace with your coordinates)
  latitude = "27.9880614";
  longitude = "86.92521";
  
  # Schedule settings
  settings = {
    dawn-time = "6:00-7:45";
    dusk-time = "18:35-20:15";
  };
  
  # General settings
  brightness = {
    day = "1";
    night = "0.8";
  };
  
  extraOptions = [
    "-v"
    "-m randr"
  ];
};

# Setting the location works either by using a provider
services.geoclue2.enable = true;
location.provider = "geoclue2";

# Or like this, which can also be set in services.redshift
location.latitude = "27.9880614";
location.longitude = "86.92521";

Tips and Tricks

Location of Options

The home manager options are defined in the following Home Manager Options Manual.

The global options are listed on MyNixOS.

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

Troubleshooting

Provider is unable to determine location

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.

References