sidebar: night light dialog

This commit is contained in:
end-4
2025-10-22 22:16:58 +02:00
parent 6ed9c9869e
commit bb08c61b76
9 changed files with 244 additions and 47 deletions
@@ -4,6 +4,7 @@ import QtQuick
import qs.modules.common
import Quickshell
import Quickshell.Io
import Quickshell.Hyprland
/**
* Simple hyprsunset service with automatic mode.
@@ -111,18 +112,28 @@ Singleton {
}
}
function toggle() {
function toggle(active = undefined) {
if (root.manualActive === undefined) {
root.manualActive = root.active;
root.manualActiveHour = root.clockHour;
root.manualActiveMinute = root.clockMinute;
}
root.manualActive = !root.manualActive;
root.manualActive = active !== undefined ? active : !root.manualActive;
if (root.manualActive) {
root.enable();
} else {
root.disable();
}
}
// Change temp
Connections {
target: Config.options.light.night
onColorTemperatureChanged: {
if (!root.active) return;
Hyprland.dispatch(`hyprctl hyprsunset temperature ${Config.options.light.night.colorTemperature}`);
Quickshell.execDetached(["hyprctl", "hyprsunset", "temperature", `${Config.options.light.night.colorTemperature}`]);
}
}
}