Repository navigation
Replies: 1 comment
Caelestia Shell — Night Light (
|
| Package | Version | Purpose |
|---|---|---|
hyprsunset |
>= 0.4.0 |
Blue-light filter / screen color temperature daemon for Hyprland (via Wayland xx-color-management / CTM) |
hyprland (hyprctl) |
Existing | Sends IPC commands (hyprctl hyprsunset temperature [temp]) to the running hyprsunset instance |
Hyprland Startup (Lua Configuration)
For hyprctl hyprsunset temperature commands to succeed, the hyprsunset daemon must be running in the active Hyprland session:
- User configuration (hypr-user.lua):
hl.on("hyprland.start", function() hl.exec_cmd("hyprsunset") end)
- Upstream dotfiles (
caelestia-dots/caelestia— execs.lua):
Addhl.exec_cmd("hyprsunset")inside thehl.on("hyprland.start", function() ... end)block inhypr/hyprland/execs.lua.
3. Code & Configuration Changes
A) QML Delegate: modules/utilities/cards/Toggles.qml
Import Quickshell and Quickshell.Io, and register a DelegateChoice for roleValue: "nightLight" inside DelegateChooser (placed right after dnd and before vpn):
--- a/modules/utilities/cards/Toggles.qml
+++ b/modules/utilities/cards/Toggles.qml
@@ -2,6 +2,8 @@
import QtQuick
import QtQuick.Layouts
+import Quickshell
+import Quickshell.Io
import Quickshell.Bluetooth
import Caelestia.Components
import Caelestia.Config
@@ -140,6 +142,39 @@
}
}
DelegateChoice {
+ roleValue: "nightLight"
+ delegate: Toggle {
+ id: nl
+
+ readonly property int nightTemp: 4000
+ readonly property int normalTemp: 6500
+ property bool nightActive: false
+
+ icon: nightActive ? "nightlight" : "light_mode"
+ checked: nightActive
+ onClicked: {
+ nightActive = !nightActive;
+ Quickshell.execDetached([
+ "hyprctl", "hyprsunset", "temperature",
+ String(nightActive ? nightTemp : normalTemp)
+ ]);
+ }
+
+ // Read actual temperature state when delegate is created/reloaded
+ Process {
+ command: ["hyprctl", "hyprsunset", "temperature"]
+ running: true
+ stdout: StdioCollector {
+ onStreamFinished: {
+ const t = parseInt(text);
+ if (!isNaN(t))
+ nl.nightActive = t < nl.normalTemp;
+ }
+ }
+ }
+ }
+ }
+ DelegateChoice {
roleValue: "vpn"
delegate: Toggle {
icon: "vpn_key"B) User Config: ~/.config/caelestia/shell.json
Add { "id": "nightLight", "enabled": true } to utilities.quickToggles:
--- a/shell.json
+++ b/shell.json
@@ -89,5 +89,41 @@
"sidebar": {
"dragThreshold": 80,
"enabled": true
+ },
+ "utilities": {
+ "quickToggles": [
+ {
+ "id": "wifi",
+ "enabled": true
+ },
+ {
+ "id": "bluetooth",
+ "enabled": true
+ },
+ {
+ "id": "mic",
+ "enabled": true
+ },
+ {
+ "id": "settings",
+ "enabled": true
+ },
+ {
+ "id": "gameMode",
+ "enabled": true
+ },
+ {
+ "id": "dnd",
+ "enabled": true
+ },
+ {
+ "id": "vpn",
+ "enabled": false
+ },
+ {
+ "id": "nightLight",
+ "enabled": true
+ }
+ ]
}
}C) Upstream C++ Default Config & Settings UI (Optional for Full Upstream Integration)
plugin/src/Caelestia/Config/utilitiesconfig.hpp:
AddLIST_ENTRY(nightLight, true)toquickTogglesdefault entries so it is enabled out of the box without requiring manualshell.jsonedits:CONFIG_LIST(EntryList, quickToggles, DEFAULT_ARG({ LIST_ENTRY(wifi, true), LIST_ENTRY(bluetooth, true), LIST_ENTRY(mic, true), LIST_ENTRY(settings, true), LIST_ENTRY(gameMode, true), LIST_ENTRY(dnd, true), LIST_ENTRY(nightLight, true), LIST_ENTRY(vpn, false), }))
modules/nexus/pages/panels/UtilitiesPanel.qml:
Add aToggleRowin the Nexus settings panel so users can toggle visibility of the Night Light button from the GUI:ToggleRow { text: Tr.tr("Night light") subtext: Tr.tr("Toggle blue light filter (hyprsunset)") disabled: !Config.utilities.cards.quickToggles checked: root.isToggleOn("nightLight") onToggled: root.setToggleOn("nightLight", checked) }
4. Verification & Command Outputs
Tested on CachyOS (Hyprland + Quickshell / Caelestia Shell v2.5.0) with hyprsunset 0.4.0-3.1:
- Enable Night Light (
4000K):$ hyprctl hyprsunset temperature 4000 ok
- Query Current Temperature (no arguments):
$ hyprctl hyprsunset temperature 4000
- Reset to Normal Temperature (
6500K):$ hyprctl hyprsunset temperature 6500 ok $ hyprctl hyprsunset temperature 6500
- Quickshell Runtime Verification:
- Reloaded via
caelestia shell -dand opened the Utilities drawer viacaelestia shell drawers toggle utilities. - Verified via
caelestia shell -lthat the configuration andToggles.qmlloaded with zero QML warnings or errors.
- Reloaded via
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
caelestia_nightlight_contribution_report.md

All reactions