From 377b15be4b4ad7e88a3bac47f49059e45a954644 Mon Sep 17 00:00:00 2001 From: Omarchybot <317366263+omarchybot@users.noreply.github.com> Date: Thu, 1 Oct 2026 11:29:30 +0200 Subject: [PATCH] Don't fire a pending idle action whose timeout was set to 0 The timers' intervals are bound to the configured delays, so setting the lock or screensaver to 0 while the screensaver is up turns a pending timer's interval to 0 and it fires at once. Check the action is still enabled when its timer fires. Co-Authored-By: Claude Opus 5.5 --- shell/plugins/services/idle/Service.qml | 4 ++-- test/shell.d/idle-test.sh | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/shell/plugins/services/idle/Service.qml b/shell/plugins/services/idle/Service.qml index c0545a73..9321150d 100644 --- a/shell/plugins/services/idle/Service.qml +++ b/shell/plugins/services/idle/Service.qml @@ -267,14 +267,14 @@ Item { id: screensaverTimer interval: root.screensaverDelaySeconds * 1000 repeat: false - onTriggered: root.launchScreensaver() + onTriggered: if (root.screensaverEnabled) root.launchScreensaver() } Timer { id: lockTimer interval: root.lockDelaySeconds * 1000 repeat: false - onTriggered: if (root.idleEnabled && root.idledThisCycle) root.lockSystem("lock-timeout") + onTriggered: if (root.idleEnabled && root.idledThisCycle && root.lockEnabled) root.lockSystem("lock-timeout") } Timer { diff --git a/test/shell.d/idle-test.sh b/test/shell.d/idle-test.sh index 2b4deeba..d5bd7afa 100644 --- a/test/shell.d/idle-test.sh +++ b/test/shell.d/idle-test.sh @@ -33,6 +33,14 @@ assert( /if \(root\.lockEnabled\) \{\s*\n\s*if \(root\.lockDelaySeconds === 0\) lockSystem/.test(serviceSource), 'idle does not lock immediately when lock timeout is disabled' ) +assert( + /id: screensaverTimer[\s\S]*?onTriggered: if \(root\.screensaverEnabled\) root\.launchScreensaver\(\)/.test(serviceSource), + 'idle does not launch a pending screensaver once its timeout is set to 0' +) +assert( + /id: lockTimer[\s\S]*?onTriggered: if \([^)]*root\.lockEnabled\) root\.lockSystem\("lock-timeout"\)/.test(serviceSource), + 'idle does not fire a pending lock once its timeout is set to 0' +) assertDeepEqual(idle.eventParts({ data: 'a,b,c' }, 2), ['a', 'b', 'c'], 'idle parses raw event data') assertDeepEqual(