Skip to content

Add automatic time-based nightlight schedule with TUI manager#5928

Closed
mplaczek99 wants to merge 6 commits into
basecamp:devfrom
mplaczek99:auto-nightlight-toggle
Closed

Add automatic time-based nightlight schedule with TUI manager#5928
mplaczek99 wants to merge 6 commits into
basecamp:devfrom
mplaczek99:auto-nightlight-toggle

Conversation

@mplaczek99
Copy link
Copy Markdown
Contributor

@mplaczek99 mplaczek99 commented May 21, 2026

Fixes #5929.

Summary

  • Adds an opt-in, time-based nightlight schedule managed through a gum TUI
  • Repoints the toggle menu's Nightlight entry and the SUPER+CTRL+N keybinding at the TUI
  • Removes the standalone manual omarchy toggle nightlight (redundant with the schedule's enable/disable)
  • Settings (intensity / start / end) persist across reboots; off by default; user's pre-enable hyprsunset.conf is preserved and restored on disable

What changes

Both the Trigger → Toggle → Nightlight entry and the SUPER+CTRL+N keybinding now open a floating terminal running omarchy-tui-nightlight. The TUI shows current status, intensity (K), and the start/end times, and lets the user:

  • Enable / disable the schedule
  • Pick intensity from presets (3000–5500K) or a custom Kelvin value
  • Set start / end times from presets or HH:MM input

When enabled, the schedule writes the chosen warm + identity profiles to ~/.config/hypr/hyprsunset.conf and adds hyprsunset to autostart. Both the post-Lua-migration autostart.lua and the pre-migration autostart.conf formats are supported. The user's pre-enable hyprsunset.conf is copied to ~/.local/state/omarchy/hyprsunset.preauto.conf so a customized config isn't lost — on disable it's moved back into place; if no backup is present (state wiped, fresh install) the Omarchy default is used as a fallback. The autostart entry is removed on disable.

State lives in:

  • ~/.local/state/omarchy/toggles/nightlight-schedule — enabled flag
  • ~/.local/state/omarchy/nightlight-schedule.confTEMPERATURE, START_TIME, END_TIME
  • ~/.local/state/omarchy/hyprsunset.preauto.conf — backup of the user's pre-enable config (transient; removed on disable)

Defaults: disabled, 4000K, 20:00 → 07:00.

New commands

Route Purpose
omarchy tui nightlight The TUI manager (also reached via menu / SUPER+CTRL+N)
omarchy nightlight schedule status|enable|disable|toggle|apply Headless control
omarchy nightlight schedule set-intensity <K> Update temperature (validated 1000–6500)
omarchy nightlight schedule set-start <HH:MM> / set-end <HH:MM> Update schedule times
omarchy toggle nightlight-schedule Thin wrapper for the toggle

Removed

  • omarchy-toggle-nightlight (the standalone manual 4000K ↔ 6000K toggle). Anything that used to call it should now use omarchy nightlight schedule enable / disable, or open the TUI.

Test plan

  • SUPER+CTRL+N opens the TUI; panel shows defaults (Disabled · 4000K · 20:00 · 07:00) on first launch
  • Trigger → Toggle → Nightlight opens the same TUI
  • Enable from the TUI → user's previous hyprsunset.conf is copied to ~/.local/state/omarchy/hyprsunset.preauto.conf; live config is replaced with managed content; autostart line is added; hyprsunset starts
  • Change intensity / start / end while enabled → hyprsunset.conf re-renders with new values
  • Disable → previous hyprsunset.conf is restored from the backup, backup is removed, autostart line stripped, hyprsunset killed
  • Re-enable preserves prior settings from the state file and captures a fresh backup
  • Disable with no backup file (e.g. wiped state) falls back to the Omarchy default hyprsunset.conf
  • Invalid input (temp outside 1000–6500, malformed time) is rejected with a flash error in the TUI / non-zero exit in the CLI
  • Reboot with schedule enabled → hyprsunset autostarts and schedule is active
  • omarchy commands lists the new routes; bash test/omarchy-cli-test.sh still green

Replaces the Nightlight entry in the toggle menu with a gum-based TUI that
manages an opt-in, time-based hyprsunset schedule. Users can enable/disable
the schedule and set intensity (temperature), start time, and end time. The
existing manual SUPER+CTRL+N keybinding and 'omarchy toggle nightlight'
command are unchanged.

When enabled, the schedule writes the user's chosen warm and identity
profiles to ~/.config/hypr/hyprsunset.conf and adds hyprsunset to autostart
(supports both autostart.lua and pre-migration autostart.conf). When
disabled, hyprsunset.conf is restored to the Omarchy default and the
autostart entry is removed.

Settings persist in ~/.local/state/omarchy/nightlight-schedule.conf and the
enabled flag at ~/.local/state/omarchy/toggles/nightlight-schedule. Defaults
are off, 4000K, 20:00 to 07:00.
Copilot AI review requested due to automatic review settings May 21, 2026 01:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds an automatic, time-based nightlight schedule to Hyprland via hyprsunset, including a gum-powered TUI and new CLI entrypoints to enable/disable and configure the schedule.

Changes:

  • Introduces omarchy-nightlight-schedule to store schedule state, write hyprsunset.conf, and manage autostart + apply/revert behavior.
  • Adds an interactive TUI (omarchy-tui-nightlight) and a toggle wrapper (omarchy-toggle-nightlight-schedule).
  • Updates menu + config guidance to point users to the new schedule workflow.

Reviewed changes

Copilot reviewed 1 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
config/hypr/hyprsunset.conf Updates user-facing guidance for enabling/configuring the nightlight schedule.
bin/omarchy-tui-nightlight New interactive TUI for configuring and toggling the schedule.
bin/omarchy-toggle-nightlight-schedule New wrapper command to toggle the schedule.
bin/omarchy-nightlight-schedule Core schedule manager: persists state, writes hyprsunset profiles, adjusts autostart, applies changes.
bin/omarchy-menu Routes “Nightlight” toggle menu entry to the new TUI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +8 to +15
# For an automatic time-based schedule, open Trigger > Toggle > Nightlight in
# the Omarchy menu (or run: omarchy toggle nightlight-schedule). The menu lets
# you set the intensity and start/end times; the schedule writes profiles here
# and adds hyprsunset to autostart.
#
# To schedule by hand instead, add to ~/.config/hypr/autostart.lua:
# o.launch_on_start("hyprsunset")
# and append a profile block here:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You get to the Toggle menu by going through the Trigger menu first. It is: Trigger > Toggle

Replaces the manual temperature toggle bound to SUPER+CTRL+N with a launch
of omarchy-tui-nightlight, matching the Trigger > Toggle > Nightlight menu
entry. omarchy-toggle-nightlight is still available from the CLI for users
who script it.
@mplaczek99
Copy link
Copy Markdown
Contributor Author

mplaczek99 commented May 21, 2026

I think that we should consider moving Nightlight from Trigger > Toggle > Nightlight to another area in the Omarchy Menu. But where?

… notifications

Removes bin/omarchy-toggle-nightlight. The schedule's enable/disable
covers turning the warm tint on and off; the standalone temperature
toggle is redundant now that the menu, keybinding, and CLI all route
through the schedule.

Backs up the user's pre-enable ~/.config/hypr/hyprsunset.conf to
~/.local/state/omarchy/hyprsunset.preauto.conf on first enable and
restores from it on disable. Falls back to the Omarchy default when no
backup is present, so a wiped state still recovers cleanly. Avoids the
data-loss risk of clobbering a customized hyprsunset.conf.

Replaces the stale 'Auto-nightlight enabled/disabled' notification
strings with 'Nightlight enabled/disabled' plus the moon glyph, matching
the menu wording and other omarchy toggle notifications.

Updates the SKILL.md example from 'omarchy toggle nightlight' (now gone)
to the new TUI command, and swaps the generic toggle-group example to
'omarchy toggle screensaver'.
Copilot AI review requested due to automatic review settings May 21, 2026 02:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 9 changed files in this pull request and generated 1 comment.

Comment thread default/omarchy-skill/SKILL.md Outdated
I was missing a hypen in omarchy nightlight to be omarchy-nightlight

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 21, 2026 02:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 9 changed files in this pull request and generated 1 comment.

Comment thread config/hypr/hyprsunset.conf Outdated
The previous comment implied 'omarchy toggle nightlight-schedule' opened
a configuration menu, but the toggle wrapper only flips the schedule
on/off. Direct users to 'omarchy tui nightlight' for interactive config
and keep the toggle command as a separate, on/off-only entry.
@dhh
Copy link
Copy Markdown
Member

dhh commented May 21, 2026

It's an interesting idea, but I think it's too much code. I also don't think a fixed time frame is going to be right in most places. Would need something that tracks sunrise/sunset. I think this would be best explored in an external AUR package. Thanks for looking at this!

@dhh dhh closed this May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configurable automatic nightlight schedule

3 participants