complete-computing-environment/clight.org

1.9 KiB

Clight

Clight is software which tints a Linux computer display to remove blue light from the light spectrum and adjusts the brightness based on webcam or light sensor state. Various qualities of science is out on whether this helps you sleep, but it's valuable to me to match the light temperature of my display match that of my lights, and I find that warmer lights cause less strain. Additionally, Clight lets me scale down the backlight volume and the gamma ramps. I run it simply as a SystemD User Service.

{ pkgs, lib, ... }:

{
  # https://github.com/FedeDP/Clightd/pull/109 this is gonna be a bit of a pain to integrate lol, disable clight for now...
  # clightd = clightd.overrideAttrs (old: {
  #   patches = [
  #     (fetchpatch {
  #       name = "kwin_output-management_wayland_protocol.patch";
  #       url = "https://github.com/FedeDP/Clightd/commit/8d6853a98b0edf06f10d5fad1eaaa7b3727f36e3.patch";
  #       sha256 = "sha256-4FCn+MOdbJGINq0lRtQFS7iGZP0k5nvNRWVHjEmrZKI=";
  #     })
  #   ];
  # });
  services.clight.enable = false;
  services.clight.settings = {
    inhibit.inhibit_docked = true;

    backlight.ac_timeouts = [ 120 300 60 ];
    backlight.batt_timeouts = [ 120 300 60 ];
    backlight.pause_on_lid_closed = true;
    backlight.capture_on_lid_opened = true;

    sensor.ac_regression_points = [ 0.20 0.29 0.45 0.61 0.74 0.81 0.88 0.93 0.97 1.0 ];
    sensor.batt_regression_points = [ 0.20 0.23 0.36 0.52 0.59 0.65 0.71 0.75 0.78 0.80 ];

    keyboard.dim = true;
  };
  location.provider = "geoclue2";
}