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 <noreply@anthropic.com>
This commit is contained in:
OmarchybotandClaude Opus 5.5 committed 2026-10-01 11:29:30 +02:00
1 parent 14921a956e
commit 377b15be4b
2 files changed
+10 -2

No files matched your search

+2 -2
View File
@@ -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 {
+8
View File
@@ -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(