From 3cebdc3412e6bb53dbffc57c36edff29b9c0446f Mon Sep 17 00:00:00 2001 From: Omarchybot <317366263+omarchybot@users.noreply.github.com> Date: Thu, 1 Oct 2026 12:30:46 +0200 Subject: [PATCH] End a running idle cycle when both timeouts are set to 0 With both at 0 the monitor is disabled and handleIdleChanged returns early, so a cycle already running when shell.json changed never cancels: omarchy-system-wake never runs, and if the screensaver never opened a window nothing else ends it. Cancel it the way turning on stay-awake does. Co-Authored-By: Claude Opus 5.5 Co-Authored-By: Codex Medium --- shell/plugins/services/idle/Service.qml | 3 +++ test/shell.d/idle-test.sh | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/shell/plugins/services/idle/Service.qml b/shell/plugins/services/idle/Service.qml index 860a3b23..8fb45a6c 100644 --- a/shell/plugins/services/idle/Service.qml +++ b/shell/plugins/services/idle/Service.qml @@ -263,6 +263,9 @@ Item { return applyStayAwake(!value, true, "ipc") } + // With both timeouts at 0 the monitor stops reporting, so nothing else would end a running cycle. + onIdleTimersEnabledChanged: if (!idleTimersEnabled) cancelIdleCycle("idle-timers-disabled") + IdleMonitor { id: idleMonitor enabled: root.idleEnabled && root.idleTimersEnabled diff --git a/test/shell.d/idle-test.sh b/test/shell.d/idle-test.sh index a5057a26..450c8d5a 100644 --- a/test/shell.d/idle-test.sh +++ b/test/shell.d/idle-test.sh @@ -51,6 +51,10 @@ assert( !/interval: root\.screensaverDelaySeconds/.test(serviceSource), 'idle keeps a pending screensaver on its deadline when shell.json changes mid-cycle' ) +assert( + /onIdleTimersEnabledChanged: if \(!idleTimersEnabled\) cancelIdleCycle\(/.test(serviceSource), + 'idle ends a running cycle when both timeouts are set to 0' +) assertDeepEqual(idle.eventParts({ data: 'a,b,c' }, 2), ['a', 'b', 'c'], 'idle parses raw event data') assertDeepEqual(