Redshift: Difference between revisions

Phobos (talk | contribs)
No edit summary
Tags: Mobile edit Mobile web edit Visual edit
Phobos (talk | contribs)
mNo edit summary
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
[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.  
[https://github.com/jonls/redshift Redshift] is an open-source software application designed to adjust color temperature of screens based on the time of day.  


Redshift modifies the color temperature to reduce eye strain and improve sleep patterns. The 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 to reduce the amount of blue light towards the night, and increasing the amount of blue light in the morning.


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 may choose to have screen temperature automatically match their lighting based on geographic location, or based on manually set time-frames. Users may also customize day and night color temperatures, adjust the speed of transitions, and more.


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.
Redshift is best used on X11 systems as it is unmaintained and does not support Wayland.  


 
For Wayland support you may consider [[Gammastep]], a modern fork of Redshift. Alternatively there is also [[wlsunset]], which is a lightweight modern alternative.
Redshift is currently unmaintained, however [[Gammastep]] is a modern fork of Redshift that supports Wayland. There is also wlsunset which is a lightweight modern alternative.


== Installation ==
== Installation ==
==== Using nix-shell ====
<syntaxhighlight lang="console">
$ nix-shell -p redshift
</syntaxhighlight>
==== Using Global Configuration ====
==== Using Global Configuration ====
{{File|3=environment.systemPackages = [
{{File|3=environment.systemPackages = [
  pkgs.redshift
  pkgs.redshift
];|name=/etc/nixos/configuration.nix|lang=nix}}
];|name=/etc/nixos/configuration.nix|lang=nix}}
After modifying your configuration, apply the changes by running:<syntaxhighlight lang="console">
$ sudo nixos-rebuild switch
</syntaxhighlight>
==== Using Home Configuration ====
==== Using Home Configuration ====
{{File|3=home.packages = [  
{{File|3=home.packages = [  
   pkgs.redshift  
   pkgs.redshift  
];|name=/etc/nixos/home.nix|lang=nix}}
];|name=/etc/nixos/home.nix|lang=nix}}
After updating your configuration, apply the changes by running:<syntaxhighlight lang="console">
$ home-manager switch
</syntaxhighlight>
== Configuration ==
== Configuration ==
==== Basic ====
==== Global Configuration: ====
{{File|3=services.redshift = {
Options may be found under [https://search.nixos.org/options?query=services.redshift services.redshift]. For more options for configuring Geoclue, check the [[Geoclue|Geoclue page]].{{File|3=services.redshift = {
   enable = true;
   enable = true;
   temperature = {
   temperature = {
Line 45: Line 31:
location.provider = "geoclue2";|name=/etc/nixos/configuration.nix|lang=nix}}
location.provider = "geoclue2";|name=/etc/nixos/configuration.nix|lang=nix}}


==== Advanced (Home Manager) ====
==== Home Manager ====
 
===== Example Usage =====
You can find more options in [https://nix-community.github.io/home-manager/options.xhtml#opt-services.redshift.enable Home Manager: services.redshift]. This configuration defines the temperature the display will use at night and day, the schedule and length of the transition, brightness for the display to use, and whether it will use a tray icon. <code>extraOptions</code> defines additional command-line arguments to pass to <code>redshift</code>.
{{File|3=services.redshift = {
{{File|3=services.redshift = {
   enable = true;
   enable = true;
    
    
   # Display temperature settings
   # Display temperature settings (in Kelvin)
   temperature = {
   temperature = {
     day = 5700;
     day = 5500;
     night = 3500;
     night = 3500;
   };
   };
 
  # Location settings (replace with your coordinates)
  latitude = "27.9880614";
  longitude = "86.92521";
    
    
   # Schedule settings
   # Schedule settings
Line 63: Line 48:
   duskTime = "18:35-20:15";
   duskTime = "18:35-20:15";
    
    
   # General settings
   # Brightness
   brightness = {
   brightness = {
     day = "1";
     day = "1";
Line 73: Line 58:
     "-m randr"
     "-m randr"
   ];
   ];
 
 
  # Tray Icon
   tray = false;
   tray = false;


};
};|name=/etc/nixos/home.nix|lang=nix}}


# Setting the location works either by using a provider
===== Location Based Transitions =====
services.geoclue2.enable = true;
You can choose to use Redshift with location based screen temperature to match when the sun actually sets and rises in your area. Below are examples of those options using [https://gitlab.freedesktop.org/geoclue/geoclue/-/wikis/home Geoclue] and manually set coordinates.
location.provider = "geoclue2";


# Or like this, which can also be set in services.redshift
====== Geoclue ======
location.latitude = "27.9880614";
Geoclue provides location using GPS, 3G modems, GeoIP, and WiFi Geolocation. Some integrations may require additional setup.{{File|3=services.redshift = {
location.longitude = "86.92521";|name=/etc/nixos/home.nix|lang=nix}}
  enable = true;
  provider = "geoclue2";
};|name=/etc/nixos/home.nix|lang=nix}}You will also need to enable Geoclue in your global configuration [[Geoclue|(See options on the Geoclue page)]].
{{File|3=services.geoclue2.enable = true;
location.provider = "geoclue2";|name=/etc/nixos/configuration.nix|lang=nix}}


== Tips and Tricks ==
====== Coordinates ======
==== Location of Options ====
{{File|3=services.redshift = {
The Home Manager options are defined in the [https://nix-community.github.io/home-manager/options.xhtml#opt-services.gammastep.enable Home Manager Options Manual].
  enable = true;


The global options can be found under [https://search.nixos.org/options?query=services.redshift services.redshift].
  # Coordinates based location
  provider = "manual";


==== Usage ====
  latitude = "27.9880614";
<syntaxhighlight lang="shell"># If services.redshift.enable is true, the systemd unit redshift.service is provided.
  longitude = "86.92521";
# 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
};|name=/etc/nixos/home.nix|lang=nix}}
~/.config/systemd/user/default.target.wants/redshift.service
Instead of declaring your coordinates in Redshift, you can also declare them globally for your device in your global configuration:
 
{{File|3=location = {
# After starting the service, make sure to check its status in the service manager:
  provider = "manual";
systemctl --user status redshift</syntaxhighlight>
  latitude = "27.9880614";
  longitude = "86.92521";
};|name=/etc/nixos/configuration.nix|lang=nix}}


== Troubleshooting ==
== Troubleshooting ==