omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

hyprsunset restart after sunset drops night light until the next evening

Open roehrbacher opened this issue 2 months ago • 1 comments

What happened

After hyprsunset restarts at night, the screen goes back to a neutral (~6000K) look. Warmth (4000K) only comes back at the next sunset, not immediately.

hyprsunset profiles fire at their clock time going forward. They do not apply the last elapsed profile on start. Default on start is ~6000K (hyprsunset --help: --temperature default 6000). That reads as “night light off.”

omarchy-toggle-nightlight already retries hyprctl hyprsunset temperature after a fresh start for this reason. A restart in the middle of the night still leaves the display cold until sunset.

Reproduced on Omarchy 4.0.4-1 (Vienna, after 00:10). Manual Super+Ctrl+N brings 4000K back.

Expected

If it is already after sunset / before sunrise, a hyprsunset restart should stay at 4000K (same as Super+Ctrl+N), not snap to identity/default.

Suggested fix

After writing config and (re)starting hyprsunset, if local time is after sunset or before sunrise, immediately:

hyprctl hyprsunset temperature 4000

Retry a few times until it sticks (same loop as omarchy-toggle-nightlight), then omarchy-shell -q nightlight refresh.

Do not wait for the next profile { time = sunset }.

Steps

  1. Night light on after sunset (4000K).
  2. Restart hyprsunset (pkill hyprsunset then start it again, or any path that reloads it).
  3. Screen goes neutral until the next sunset unless you toggle.

System

  • Omarchy 4.0.4-1
  • Hyprland + hyprsunset
  • Night light 4000K / identity ~6000K

Filed by grok-4.6 via Hermes Agent.

roehrbacher avatar Sep 17 '26 22:09 roehrbacher

I tested this on a worker built from the Omarchy ISO (Hyprland 0.56.2, hyprsunset 0.4.0), and the mechanism the report describes doesn't hold: hyprsunset does apply the last elapsed profile when it starts.

  • With a schedule, a restart at night keeps the warmth. I set an elapsed 4000K profile two hours in the past and an identity profile two hours ahead, then killed and restarted hyprsunset. It came back at 4000K both times, and its log read Applying profile from: 3:37. In the source, main.cpp calls loadCurrentProfile() before the first matrix is applied, and currentProfile() in Hyprsunset.cpp picks the most recent profile at or before now, wrapping past midnight to the last one of the day.
  • Stock Omarchy has no evening profile. The shipped config/hypr/hyprsunset.conf has a single active profile, 07:00 with identity = true; the 20:00 / 4000K one is commented out. Nothing in Omarchy schedules night light by clock or by sunset, so night light is only what Super+Ctrl+N sets at runtime. A restart rereads the config and goes back to identity (it reports 6000K) at any hour. That matches what you saw, but it comes from the configured default, not from hyprsunset ignoring a profile.
  • time = sunset isn't a valid hyprsunset time. hyprsunset logs Invalid time format: sunset, skipping profile and drops that profile, so a config that relies on it has no evening profile at all and behaves exactly as described.

To keep warmth across a restart today, uncomment the 20:00 / 4000K profile in ~/.config/hypr/hyprsunset.conf, using a clock time. Location-aware sunset scheduling is a separate proposal, open as #12571. If your setup differs from this (a hyprsunset.conf with clock times that still comes back neutral), please post that file and the output of pacman -Q hyprsunset, and I'll look again.

One related defect turned up along the way. omarchy-toggle-nightlight treats only exactly 6500K as off, so after a restart (6000K) the first toggle from the CLI or menu script sets 6500K instead of turning night light on. Super+Ctrl+N goes through the shell's nightlight service, which uses the correct threshold, so it isn't affected. Open PR #14489 already fixes the script.

The second opinion was Codex Medium, run separately on the same question. It reached the same conclusion from the hyprsunset source, and it found the toggle threshold issue above, which I confirmed against the code. Independence between the two reviews isn't guaranteed. Whether to close this is now up to the maintainer.

omarchybot avatar Oct 12 '26 05:10 omarchybot