Skip to content

[BUG]: after sleep/suspend, gamma and color temperature is reset #39

@MrStickyPiston

Description

@MrStickyPiston

Im using NixOS stable with the flake.
My nix config is the following:

{
  inputs,
  pkgs,
  config,
  ...
}:
let
  package = inputs.sunsetr.packages.${pkgs.system}.sunsetr;
in
{
  # Allow manually changing gamma/temperature
  home.packages = [
    package
  ];

  xdg.configFile."sunsetr/sunsetr.toml".source = ./config.toml;

  systemd.user.services.sunsetr = {
    Install = {
      WantedBy = [ "graphical-session.target" ];
    };

    Unit = {
      ConditionEnvironment = "WAYLAND_DISPLAY";
      After = [ "graphical-session.target" ];
      PartOf = [ "graphical-session.target" ];
      Requires = [ "graphical-session.target" ];
    };

    Service = {
      ExecStart = "${package}/bin/sunsetr";
      Restart = "on-failure";
      RestartSec = "10";
      Slice = "background.slice";
    };
  };
}

My config.toml/sunsetr.toml looks like this:

#[Backend]
backend = "auto"                # Backend to use: "auto", "hyprland", "hyprsunset" or "wayland"
transition_mode = "finish_by"   # Select: "geo", "finish_by", "start_at", "center", "static"

#[Smoothing]
smoothing = true                # Enable smooth transitions during startup and exit
startup_duration = 0.5          # Duration of smooth startup in seconds (0.1-60 | 0 = instant)
shutdown_duration = 0.5         # Duration of smooth shutdown in seconds (0.1-60 | 0 = instant)
adaptive_interval = 1           # Adaptive interval base for smooth transitions (1-1000)ms

#[Time-based config]
night_temp = 1900               # Color temperature during night (1000-20000) Kelvin
day_temp = 6500                 # Color temperature during day (1000-20000) Kelvin
night_gamma = 90                # Gamma percentage for night (10-200%)
day_gamma = 100                 # Gamma percentage for day (10-200%)
update_interval = 60            # Update frequency during transitions in seconds (10-300)

#[Static config]
static_temp = 6500              # Color temperature for static mode (1000-20000) Kelvin
static_gamma = 100              # Gamma percentage for static mode (10-200%)

#[Manual transitions]
sunset = "18:00:00"             # Time for manual sunset calculations (HH:MM:SS)
sunrise = "06:00:00"            # Time for manual sunrise calculations (HH:MM:SS)
transition_duration = 45        # Transition duration in minutes (5-120)

There is an ampty geo.toml file in the config dir, else it would not start without geo section.

This are the logs of the systemd service:

[sticky@NixUSB:~/nixos-config]$ systemctl status --user sunsetr.service
● sunsetr.service
     Loaded: loaded (/home/sticky/.config/systemd/user/sunsetr.service; enabled; preset: ignored)
     Active: active (running) since Tue 2025-11-11 18:18:34 CET; 1min 15s ago
 Invocation: 791d7681792748e389a537b0828e207c
   Main PID: 32872 (sunsetr)
      Tasks: 9 (limit: 38078)
     Memory: 3.1M (peak: 4.3M)
        CPU: 113ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/background.slice/sunsetr.service
             └─32872 /nix/store/zxr17ivhdg7cx3p5yp4dqrilvl95m756-sunsetr-0.11.1-6e994ac/bin/sunsetr

nov 11 18:18:34 NixUSB sunsetr[32872]: ┃
nov 11 18:18:34 NixUSB sunsetr[32872]: ┣ Entering night mode <U+F4EE>
nov 11 18:18:34 NixUSB sunsetr[32872]: ┃
nov 11 18:18:34 NixUSB sunsetr[32872]: ┣ Next transition in 10 hours 56 minutes
nov 11 18:19:28 NixUSB sunsetr[32872]: ┃
nov 11 18:19:28 NixUSB sunsetr[32872]: ┣[INFO] System entering sleep/suspend mode
nov 11 18:19:36 NixUSB sunsetr[32872]: ┃
nov 11 18:19:36 NixUSB sunsetr[32872]: ┣[INFO] System resuming from sleep/suspend - reloading
nov 11 18:19:36 NixUSB sunsetr[32872]: ┃
nov 11 18:19:36 NixUSB sunsetr[32872]: ┣[INFO] Configuration reloaded (no state change needed)

Metadata

Metadata

Assignees

Labels

upstreamRequires upstream fix

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions