From ab2fb2b85f55d78877c8cbc5c771d421dc626ed7 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 16 May 2026 15:40:43 +0200 Subject: [PATCH] Better night light toggle --- .../plugins/bar/widgets/controlCenter.qml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/default/quickshell/omarchy-shell/plugins/bar/widgets/controlCenter.qml b/default/quickshell/omarchy-shell/plugins/bar/widgets/controlCenter.qml index 088e4600..52a98731 100644 --- a/default/quickshell/omarchy-shell/plugins/bar/widgets/controlCenter.qml +++ b/default/quickshell/omarchy-shell/plugins/bar/widgets/controlCenter.qml @@ -39,6 +39,7 @@ Item { property bool idleInhibited: false property bool nightLightActive: false property bool nightLightAvailable: false + property bool nightLightPending: false property string themeName: "" property string backgroundName: "" @@ -52,7 +53,7 @@ Item { function refresh() { if (!brightnessProc.running) brightnessProc.running = true if (!idleProc.running) idleProc.running = true - if (!nightLightProc.running) nightLightProc.running = true + if (!nightLightPending && !nightLightProc.running) nightLightProc.running = true if (!themeProc.running) themeProc.running = true if (!backgroundProc.running) backgroundProc.running = true } @@ -110,12 +111,22 @@ Item { return } root.nightLightAvailable = true + if (root.nightLightPending) return var temp = parseInt(state, 10) root.nightLightActive = !isNaN(temp) && temp < 6000 } } } + Process { + id: nightLightToggleProc + command: ["omarchy-toggle-nightlight"] + onExited: { + root.nightLightPending = false + if (!nightLightProc.running) nightLightProc.running = true + } + } + Process { id: themeProc command: ["omarchy-theme-current"] @@ -201,9 +212,10 @@ Item { opacity: root.nightLightAvailable ? 1 : 0.4 enabled: root.nightLightAvailable onClicked: { + if (nightLightToggleProc.running) return root.nightLightActive = !root.nightLightActive - root.run("omarchy-toggle-nightlight") - nightLightProc.running = true + root.nightLightPending = true + nightLightToggleProc.running = true } }