Harden Panama launcher actions

This commit is contained in:
Gabriel Brown
2026-08-18 07:31:11 -04:00
parent b28edcd01f
commit ca64d4b9b6
11 changed files with 239 additions and 40 deletions
+18 -1
View File
@@ -26,6 +26,7 @@ Singleton {
id: root
property bool initialized: false
property bool suppressStatusEvents: false
// The manual switch. Ignored while `automatic` is on.
property bool enabled: Settings.nightLightEnabledByDefault
@@ -53,6 +54,22 @@ Singleton {
}
}
// Launcher actions already provide immediate Prism OSD feedback. Keep the
// ambient Signal Glass channel quiet for that path so one choice produces
// one confirmation instead of two competing transients.
function toggleQuietly(): void {
root.suppressStatusEvents = true;
root.toggle();
root.suppressStatusEvents = false;
}
function restore(manualEnabled: bool, automaticEnabled: bool): void {
root.suppressStatusEvents = true;
root.enabled = manualEnabled;
root.automatic = automaticEnabled;
root.suppressStatusEvents = false;
}
// The window wraps midnight (17:00 → 10:00), so the comparison flips when
// `from` is later in the day than `to`.
function inWindow(hour: real): bool {
@@ -118,7 +135,7 @@ Singleton {
}
onActiveChanged: {
if (!root.initialized)
if (!root.initialized || root.suppressStatusEvents)
return;
StatusEvents.publish({
key: "display-night-light",