Jump to content

Gammastep

From Official NixOS Wiki

Gammastep is an open-source software that adjusts the color temperature of screens based on the time of day.

It does this by gradually shifting the color temperature of the display to reduce the amount of blue light towards the dusk, and increasing the amount of blue light towards dawn.

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.

Alternatively you may also consider wlsunset, which is a lightweight modern alternative.

Installation

You can install Gammastep in your global configuration like so:

❄︎ /etc/nixos/configuration.nix
environment.systemPackages = [
  pkgs.gammastep
];

Home Manager Configuration

Example Usage

You can find more options in Home Manager: services.gammastep. This configuration defines the temperature the display will use at night and day, the schedule and length of the transition, and whether it will use a tray icon. Available options for settings may be found on the Gammastep man page (Gammastep Arch Man Page).

❄︎ /etc/nixos/home.nix
services.gammastep = {
  enable = true;
  
  # Schedule and set time range for dusk/dawn
  duskTime = "18:35-20:15";
  dawnTime = "6:00-7:45";

  # Temperature to use at night/day (between 1000 and 25000 Kelvin).
  temperature = {
    day = 5500;
    night = 3700;
  };

  # Tray Icon
  tray = true;
  
  enableVerboseLogging = true;

  settings = {
    general = {
      adjustment-method = "randr";
    };
    randr = {
      screen = 0;
    };
  };

};

Location Based Transitions

You can choose to use Gammastep with location based screen temperature to match when the sun actually sets and rises in your area. Below are examples of those options using Geoclue and manually set coordinates.

Geoclue

Geoclue provides location using GPS, 3G modems, GeoIP, and WiFi Geolocation. Some integrations may require additional setup.

❄︎ /etc/nixos/home.nix
services.gammastep = {
  enable = true;
  provider = "geoclue2";
};

You will also need to enable Geoclue in your global configuration (See options on the Geoclue page).

❄︎ /etc/nixos/home.nix
services.geoclue2.enable = true;
location.provider = "geoclue2";

Coordinates

❄︎ /etc/nixos/home.nix
services.gammastep = {
  enable = true;

  # Coordinates based location
  provider = "manual";

  latitude = "27.9";
  longitude = "86.9";

};

Instead of declaring your coordinates in Gammastep, you may also choose to declare them globally for your device in your global configuration:

❄︎ /etc/nixos/configuration.nix
location = {
  provider = "manual";
  latitude = "27.9";
  longitude = "86.9";
};

See also

  • Redshift, original implementation only supporting X11 (unmaintained).