From 020f966b3eb2c090c43b6af058764f28b88a23d1 Mon Sep 17 00:00:00 2001 From: air Date: Sat, 3 Oct 2026 23:38:28 -0700 Subject: [PATCH 1/6] Close the screensaver when its idle cycle is cancelled cancelIdleCycle stopped the timers but never closed the screensaver terminal it had launched, so enabling Stay Awake mid-cycle left the screensaver up with no lock pending. Close the screensaver window when a cycle that launched it is cancelled. --- shell/plugins/services/idle/Service.qml | 9 +++++++++ test/shell.d/idle-test.sh | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/shell/plugins/services/idle/Service.qml b/shell/plugins/services/idle/Service.qml index 19dab2a2d446..2d5f52d2462e 100644 --- a/shell/plugins/services/idle/Service.qml +++ b/shell/plugins/services/idle/Service.qml @@ -105,6 +105,11 @@ Item { lockTimer.stop() screensaverLaunchGraceTimer.stop() + // The screensaver is a separate terminal process, so cancelling the cycle + // does not close it on its own. Close it here, or it stays up until the + // next keypress even though nothing is left to lock the session. + if (root.screensaverStartedThisCycle) runProcess(screensaverCloseProcess, "screensaver-close", "pkill -f '[o]rg.omarchy.screensaver' || true") + if (root.idledThisCycle) runProcess(wakeProcess, "wake", "omarchy-system-wake") root.idledThisCycle = false @@ -291,6 +296,10 @@ Item { id: screensaverProcess onExited: function(exitCode, exitStatus) { root.logEvent("process-exit", "screensaver exitCode=" + exitCode + " status=" + exitStatus) } } + Process { + id: screensaverCloseProcess + onExited: function(exitCode, exitStatus) { root.logEvent("process-exit", "screensaver-close exitCode=" + exitCode + " status=" + exitStatus) } + } Process { id: lockProcess onExited: function(exitCode, exitStatus) { root.logEvent("process-exit", "lock exitCode=" + exitCode + " status=" + exitStatus) } diff --git a/test/shell.d/idle-test.sh b/test/shell.d/idle-test.sh index 62a19c2ce03e..bac8e4f9c4c5 100644 --- a/test/shell.d/idle-test.sh +++ b/test/shell.d/idle-test.sh @@ -52,3 +52,10 @@ if rg -q 'omarchy-shell' "$ROOT/bin/omarchy-toggle-idle"; then fi pass "Stay Awake toggle persists state without reentrant shell IPC" + +cancel_block=$(awk '/function cancelIdleCycle/,/^ }$/' "$ROOT/shell/plugins/services/idle/Service.qml") +if ! grep -q "pkill -f '\[o\]rg.omarchy.screensaver'" <<<"$cancel_block"; then + fail "cancelIdleCycle closes a launched screensaver window" +fi + +pass "cancelIdleCycle closes a launched screensaver window" From 9ef46a6ca456e9241399243c6567025ef68b2299 Mon Sep 17 00:00:00 2001 From: air Date: Sun, 4 Oct 2026 10:06:19 -0700 Subject: [PATCH 2/6] Close only the screensaver windows a cancelled cycle opened The previous change closed the screensaver with a pattern match, which also killed a screensaver the user started by hand, and it missed a window that opened after the cancel while the launcher was still starting. Track the windows each cycle opens and close them by address. A window that opens after a cancel during an in-flight launch is closed on arrival. Ownership and address handling live in IdleModel.js so the cases are covered by Node tests. --- shell/plugins/services/idle/IdleModel.js | 59 +++++++++++++++++++- shell/plugins/services/idle/Service.qml | 69 ++++++++++++++++++++++-- test/shell.d/idle-test.sh | 31 +++++++++-- 3 files changed, 148 insertions(+), 11 deletions(-) diff --git a/shell/plugins/services/idle/IdleModel.js b/shell/plugins/services/idle/IdleModel.js index 8e2315d0375a..1548aaf41db1 100644 --- a/shell/plugins/services/idle/IdleModel.js +++ b/shell/plugins/services/idle/IdleModel.js @@ -43,10 +43,67 @@ function screensaverWindowsAfter(windows, address, visible) { } } +// Hyprland reports window addresses without the 0x prefix on socket events but +// with it in hyprctl, so normalize to the hyprctl form before comparing or closing. +function normalizeWindowAddress(address) { + var raw = String(address || "").trim() + var hex = raw.indexOf("0x") === 0 ? raw.slice(2) : raw + if (!/^[0-9a-fA-F]+$/.test(hex)) return "" + return "0x" + hex.toLowerCase() +} + +// Windows this idle cycle opened, keyed by normalized address. Only windows +// opened while the cycle's screensaver launch was in progress are owned; a +// screensaver the user started themselves is never added. +function ownedWindowsAfterOpen(owned, address, ownsWindow) { + var next = {} + for (var existing in owned || {}) { + if (owned[existing]) next[existing] = true + } + + var key = normalizeWindowAddress(address) + if (ownsWindow && key) next[key] = true + return next +} + +function ownedWindowsAfterClose(owned, address) { + var next = {} + var key = normalizeWindowAddress(address) + for (var existing in owned || {}) { + if (owned[existing] && existing !== key) next[existing] = true + } + return next +} + +function addressesToClose(owned) { + var addresses = [] + for (var existing in owned || {}) { + if (owned[existing]) addresses.push(existing) + } + return addresses +} + +// Closes by address rather than by pattern, so only the windows this cycle +// opened are affected. +function closeWindowsCommand(addresses) { + var commands = [] + for (var i = 0; i < addresses.length; i++) { + var key = normalizeWindowAddress(addresses[i]) + if (!key) continue + commands.push("hyprctl dispatch \"hl.dsp.window.close({ window = \\\"address:" + key + "\\\" })\" >/dev/null 2>&1") + } + return commands.length ? commands.join("; ") : "true" +} + if (typeof module !== "undefined") { module.exports = { secondsFromConfig: secondsFromConfig, eventParts: eventParts, - screensaverWindowsAfter: screensaverWindowsAfter + screensaverWindowsAfter: screensaverWindowsAfter, + normalizeWindowAddress: normalizeWindowAddress, + ownedWindowsAfterOpen: ownedWindowsAfterOpen, + ownedWindowsAfterClose: ownedWindowsAfterClose, + addressesToClose: addressesToClose, + closeWindowsCommand: closeWindowsCommand } } diff --git a/shell/plugins/services/idle/Service.qml b/shell/plugins/services/idle/Service.qml index 2d5f52d2462e..a8075a1060cc 100644 --- a/shell/plugins/services/idle/Service.qml +++ b/shell/plugins/services/idle/Service.qml @@ -37,6 +37,12 @@ Item { property string lastEventAt: "" property var screensaverWindows: ({}) property int screensaverWindowCount: 0 + // Screensaver windows this cycle opened, keyed by normalized address. + property var ownedScreensaverWindows: ({}) + // Set when a cycle is cancelled after its launch started. Any screensaver + // window that opens later belongs to that launch and is closed on arrival. + property bool closeLateScreensaverWindows: false + property var pendingScreensaverCloses: [] function secondsFromConfig(value, fallback) { return IdleModel.secondsFromConfig(value, fallback) @@ -77,6 +83,7 @@ Item { screensaverLaunchGraceTimer.stop() root.idledThisCycle = false root.screensaverStartedThisCycle = false + root.ownedScreensaverWindows = ({}) resetScreensaverWindows() runProcess(lockProcess, "lock", "omarchy-system-lock") } @@ -90,6 +97,9 @@ Item { logEvent("idle-cycle-start", "screensaver=" + root.screensaverTimeoutSeconds + " lock=" + root.lockTimeoutSeconds) root.idledThisCycle = true root.screensaverStartedThisCycle = false + // A late close from a previous cycle must not catch this cycle's screensaver. + root.closeLateScreensaverWindows = false + lateScreensaverWindowTimer.stop() resetScreensaverWindows() if (root.screensaverDelaySeconds === 0) launchScreensaver() @@ -106,9 +116,14 @@ Item { screensaverLaunchGraceTimer.stop() // The screensaver is a separate terminal process, so cancelling the cycle - // does not close it on its own. Close it here, or it stays up until the - // next keypress even though nothing is left to lock the session. - if (root.screensaverStartedThisCycle) runProcess(screensaverCloseProcess, "screensaver-close", "pkill -f '[o]rg.omarchy.screensaver' || true") + // does not close it on its own. Close the windows this cycle opened, and + // close any that are still on their way if the launch has begun. + if (root.screensaverStartedThisCycle) { + root.closeLateScreensaverWindows = true + lateScreensaverWindowTimer.restart() + } + closeScreensaverWindows(IdleModel.addressesToClose(root.ownedScreensaverWindows)) + root.ownedScreensaverWindows = ({}) if (root.idledThisCycle) runProcess(wakeProcess, "wake", "omarchy-system-wake") @@ -117,6 +132,21 @@ Item { resetScreensaverWindows() } + function closeScreensaverWindows(addresses) { + if (addresses.length === 0) return + root.pendingScreensaverCloses = root.pendingScreensaverCloses.concat(addresses) + runNextScreensaverClose() + } + + // Closes run one at a time, so a close requested while another is running is + // queued instead of being skipped by runProcess. + function runNextScreensaverClose() { + if (screensaverCloseProcess.running || root.pendingScreensaverCloses.length === 0) return + var batch = root.pendingScreensaverCloses + root.pendingScreensaverCloses = [] + runProcess(screensaverCloseProcess, "screensaver-close", IdleModel.closeWindowsCommand(batch)) + } + function resetScreensaverWindows() { root.screensaverWindows = ({}) root.screensaverWindowCount = 0 @@ -131,10 +161,20 @@ Item { function handleScreensaverWindowOpened(address) { setScreensaverWindow(address, true) screensaverLaunchGraceTimer.stop() + + if (root.closeLateScreensaverWindows) { + root.ownedScreensaverWindows = IdleModel.ownedWindowsAfterClose(root.ownedScreensaverWindows, address) + closeScreensaverWindows([IdleModel.normalizeWindowAddress(address)]) + return + } + + var ownsWindow = root.idledThisCycle && root.screensaverStartedThisCycle + root.ownedScreensaverWindows = IdleModel.ownedWindowsAfterOpen(root.ownedScreensaverWindows, address, ownsWindow) } function handleScreensaverWindowClosed(address) { setScreensaverWindow(address, false) + root.ownedScreensaverWindows = IdleModel.ownedWindowsAfterClose(root.ownedScreensaverWindows, address) if (!root.idleEnabled || !root.idledThisCycle || !root.screensaverStartedThisCycle) return if (root.screensaverWindowCount > 0) return @@ -276,6 +316,19 @@ Item { onTriggered: if (root.idleEnabled && root.idledThisCycle) root.lockSystem("lock-timeout") } + // The launcher waits for its windows before it exits, so a window can arrive + // up to a few seconds after the cancel or the launcher's exit. Keep the late + // close armed until the launcher is done and that window has had time to map. + Timer { + id: lateScreensaverWindowTimer + interval: 3000 + repeat: false + onTriggered: { + if (screensaverProcess.running) return + root.closeLateScreensaverWindows = false + } + } + Timer { id: screensaverLaunchGraceTimer interval: 3000 @@ -294,11 +347,17 @@ Item { Process { id: screensaverProcess - onExited: function(exitCode, exitStatus) { root.logEvent("process-exit", "screensaver exitCode=" + exitCode + " status=" + exitStatus) } + onExited: function(exitCode, exitStatus) { + root.logEvent("process-exit", "screensaver exitCode=" + exitCode + " status=" + exitStatus) + lateScreensaverWindowTimer.restart() + } } Process { id: screensaverCloseProcess - onExited: function(exitCode, exitStatus) { root.logEvent("process-exit", "screensaver-close exitCode=" + exitCode + " status=" + exitStatus) } + onExited: function(exitCode, exitStatus) { + root.logEvent("process-exit", "screensaver-close exitCode=" + exitCode + " status=" + exitStatus) + root.runNextScreensaverClose() + } } Process { id: lockProcess diff --git a/test/shell.d/idle-test.sh b/test/shell.d/idle-test.sh index bac8e4f9c4c5..7cabab748413 100644 --- a/test/shell.d/idle-test.sh +++ b/test/shell.d/idle-test.sh @@ -53,9 +53,30 @@ fi pass "Stay Awake toggle persists state without reentrant shell IPC" -cancel_block=$(awk '/function cancelIdleCycle/,/^ }$/' "$ROOT/shell/plugins/services/idle/Service.qml") -if ! grep -q "pkill -f '\[o\]rg.omarchy.screensaver'" <<<"$cancel_block"; then - fail "cancelIdleCycle closes a launched screensaver window" -fi +run_node_test <<'JS' +const idle = requireFromRoot('shell/plugins/services/idle/IdleModel.js') + +assertEqual(idle.normalizeWindowAddress('59dac128e760'), '0x59dac128e760', 'idle adds the hyprctl prefix to socket addresses') +assertEqual(idle.normalizeWindowAddress('0xABC'), '0xabc', 'idle normalizes window address case') +assertEqual(idle.normalizeWindowAddress('bad;rm -rf'), '', 'idle rejects addresses that are not hex') + +// A window opened by this cycle's launch is owned; one opened outside it is not. +let owned = idle.ownedWindowsAfterOpen({}, '59dac1', true) +assertDeepEqual(idle.addressesToClose(owned), ['0x59dac1'], 'idle owns windows opened by the cycle launch') +owned = idle.ownedWindowsAfterOpen({}, '0xbeef', false) +assertDeepEqual(idle.addressesToClose(owned), [], 'idle does not own a screensaver the user started') + +// Closing a window that already went away removes it from ownership. +owned = idle.ownedWindowsAfterClose({ '0x59dac1': true, '0xbeef': true }, '59dac1') +assertDeepEqual(idle.addressesToClose(owned), ['0xbeef'], 'idle forgets windows that closed') + +assertEqual( + idle.closeWindowsCommand(['0x59dac1']), + 'hyprctl dispatch "hl.dsp.window.close({ window = \\"address:0x59dac1\\" })" >/dev/null 2>&1', + 'idle closes owned windows by address' +) +assertEqual(idle.closeWindowsCommand([]), 'true', 'idle close command is a no-op with no windows') +assertEqual(idle.closeWindowsCommand(['nope;x']), 'true', 'idle never builds a close command from a non-hex address') +JS -pass "cancelIdleCycle closes a launched screensaver window" +pass "idle screensaver ownership and close-by-address" From b7bfddcf85f42638af5fd8dd0ec9753c8cdfd8d4 Mon Sep 17 00:00:00 2001 From: air Date: Sun, 4 Oct 2026 10:36:21 -0700 Subject: [PATCH 3/6] Limit late screensaver closes to the windows the cancelled launch owes A cancel during launch closed any screensaver window that opened in the next few seconds, including one the user started by hand. Only one window per screen can belong to the cancelled launch, so cap the late closes at the number of screens the launch has not yet filled. Also expose the owned windows and late-close state in idle status for debugging. --- shell/plugins/services/idle/IdleModel.js | 9 ++++++++- shell/plugins/services/idle/Service.qml | 18 +++++++++++++++--- test/shell.d/idle-test.sh | 6 ++++++ 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/shell/plugins/services/idle/IdleModel.js b/shell/plugins/services/idle/IdleModel.js index 1548aaf41db1..031764aa91c7 100644 --- a/shell/plugins/services/idle/IdleModel.js +++ b/shell/plugins/services/idle/IdleModel.js @@ -83,6 +83,12 @@ function addressesToClose(owned) { return addresses } +// A cancelled launch opens one window per screen. Only that many late windows +// can belong to it; anything beyond that was started by someone else. +function lateWindowBudget(screenCount, ownedCount) { + return Math.max(0, (screenCount || 0) - (ownedCount || 0)) +} + // Closes by address rather than by pattern, so only the windows this cycle // opened are affected. function closeWindowsCommand(addresses) { @@ -104,6 +110,7 @@ if (typeof module !== "undefined") { ownedWindowsAfterOpen: ownedWindowsAfterOpen, ownedWindowsAfterClose: ownedWindowsAfterClose, addressesToClose: addressesToClose, - closeWindowsCommand: closeWindowsCommand + closeWindowsCommand: closeWindowsCommand, + lateWindowBudget: lateWindowBudget } } diff --git a/shell/plugins/services/idle/Service.qml b/shell/plugins/services/idle/Service.qml index a8075a1060cc..d57b74aa7f2e 100644 --- a/shell/plugins/services/idle/Service.qml +++ b/shell/plugins/services/idle/Service.qml @@ -42,6 +42,8 @@ Item { // Set when a cycle is cancelled after its launch started. Any screensaver // window that opens later belongs to that launch and is closed on arrival. property bool closeLateScreensaverWindows: false + // How many late windows the cancelled launch can still open, one per screen. + property int lateScreensaverWindowBudget: 0 property var pendingScreensaverCloses: [] function secondsFromConfig(value, fallback) { @@ -99,6 +101,7 @@ Item { root.screensaverStartedThisCycle = false // A late close from a previous cycle must not catch this cycle's screensaver. root.closeLateScreensaverWindows = false + root.lateScreensaverWindowBudget = 0 lateScreensaverWindowTimer.stop() resetScreensaverWindows() @@ -118,11 +121,13 @@ Item { // The screensaver is a separate terminal process, so cancelling the cycle // does not close it on its own. Close the windows this cycle opened, and // close any that are still on their way if the launch has begun. + var owned = IdleModel.addressesToClose(root.ownedScreensaverWindows) if (root.screensaverStartedThisCycle) { root.closeLateScreensaverWindows = true + root.lateScreensaverWindowBudget = IdleModel.lateWindowBudget(Quickshell.screens.length, owned.length) lateScreensaverWindowTimer.restart() } - closeScreensaverWindows(IdleModel.addressesToClose(root.ownedScreensaverWindows)) + closeScreensaverWindows(owned) root.ownedScreensaverWindows = ({}) if (root.idledThisCycle) runProcess(wakeProcess, "wake", "omarchy-system-wake") @@ -163,8 +168,12 @@ Item { screensaverLaunchGraceTimer.stop() if (root.closeLateScreensaverWindows) { - root.ownedScreensaverWindows = IdleModel.ownedWindowsAfterClose(root.ownedScreensaverWindows, address) - closeScreensaverWindows([IdleModel.normalizeWindowAddress(address)]) + // Only windows the cancelled launch is still due to open are ours; a + // screensaver started by hand after the launch is left alone. + if (root.lateScreensaverWindowBudget > 0) { + root.lateScreensaverWindowBudget -= 1 + closeScreensaverWindows([IdleModel.normalizeWindowAddress(address)]) + } return } @@ -238,6 +247,8 @@ Item { screensaverDelay: root.screensaverDelaySeconds, lockDelay: root.lockDelaySeconds, screensaverWindows: root.screensaverWindowCount, + ownedScreensaverWindows: IdleModel.addressesToClose(root.ownedScreensaverWindows), + closeLateScreensaverWindows: root.closeLateScreensaverWindows, timers: { screensaver: screensaverTimer.running, lock: lockTimer.running, @@ -326,6 +337,7 @@ Item { onTriggered: { if (screensaverProcess.running) return root.closeLateScreensaverWindows = false + root.lateScreensaverWindowBudget = 0 } } diff --git a/test/shell.d/idle-test.sh b/test/shell.d/idle-test.sh index 7cabab748413..9ffe7e78a302 100644 --- a/test/shell.d/idle-test.sh +++ b/test/shell.d/idle-test.sh @@ -77,6 +77,12 @@ assertEqual( ) assertEqual(idle.closeWindowsCommand([]), 'true', 'idle close command is a no-op with no windows') assertEqual(idle.closeWindowsCommand(['nope;x']), 'true', 'idle never builds a close command from a non-hex address') + +// A cancel during launch can only claim windows the launch has yet to open. +assertEqual(idle.lateWindowBudget(2, 0), 2, 'idle allows one late window per screen when none opened') +assertEqual(idle.lateWindowBudget(2, 1), 1, 'idle allows only the remaining late windows') +assertEqual(idle.lateWindowBudget(1, 1), 0, 'idle allows no late window once every screen has one') +assertEqual(idle.lateWindowBudget(1, 3), 0, 'idle never allows a negative budget') JS pass "idle screensaver ownership and close-by-address" From 837acdd203339c2b7ec8b327a2590cd96248541a Mon Sep 17 00:00:00 2001 From: air Date: Sun, 4 Oct 2026 11:14:18 -0700 Subject: [PATCH 4/6] Ignore repeated open events for a screensaver window already tracked A repeated openwindow event for a window the cycle already owned was counted as a late window, spending a late-close slot on a window that was closing anyway. --- shell/plugins/services/idle/Service.qml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shell/plugins/services/idle/Service.qml b/shell/plugins/services/idle/Service.qml index d57b74aa7f2e..848236227797 100644 --- a/shell/plugins/services/idle/Service.qml +++ b/shell/plugins/services/idle/Service.qml @@ -164,6 +164,9 @@ Item { } function handleScreensaverWindowOpened(address) { + // A repeated open event for a window we already track is not a new window, + // so it must not spend a late-close slot or be counted twice. + if (root.screensaverWindows[address]) return setScreensaverWindow(address, true) screensaverLaunchGraceTimer.stop() From 7c2a4e893971f5466c48aaa04c10b3458597cf43 Mon Sep 17 00:00:00 2001 From: air Date: Sun, 4 Oct 2026 11:32:37 -0700 Subject: [PATCH 5/6] Size the late-close budget from the screens at launch The budget used the screen count at cancel time, so a monitor dropping out during the launch could shrink it to zero and leave a still-opening window behind. Record the screen count when the launch starts instead. --- shell/plugins/services/idle/Service.qml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shell/plugins/services/idle/Service.qml b/shell/plugins/services/idle/Service.qml index 848236227797..f6efcc929958 100644 --- a/shell/plugins/services/idle/Service.qml +++ b/shell/plugins/services/idle/Service.qml @@ -44,6 +44,9 @@ Item { property bool closeLateScreensaverWindows: false // How many late windows the cancelled launch can still open, one per screen. property int lateScreensaverWindowBudget: 0 + // Screens the current launch is opening windows for, fixed when it starts so + // that a monitor dropping out mid-launch does not shrink the budget. + property int launchScreenCount: 0 property var pendingScreensaverCloses: [] function secondsFromConfig(value, fallback) { @@ -74,6 +77,7 @@ Item { function launchScreensaver() { root.screensaverStartedThisCycle = true + root.launchScreenCount = Quickshell.screens.length screensaverLaunchGraceTimer.restart() runProcess(screensaverProcess, "screensaver", "[[ $(omarchy-shell lock isLocked 2>/dev/null) == \"true\" ]] || omarchy-launch-screensaver") } @@ -124,7 +128,7 @@ Item { var owned = IdleModel.addressesToClose(root.ownedScreensaverWindows) if (root.screensaverStartedThisCycle) { root.closeLateScreensaverWindows = true - root.lateScreensaverWindowBudget = IdleModel.lateWindowBudget(Quickshell.screens.length, owned.length) + root.lateScreensaverWindowBudget = IdleModel.lateWindowBudget(root.launchScreenCount, owned.length) lateScreensaverWindowTimer.restart() } closeScreensaverWindows(owned) From b62c00ebb6460b3a3a0fa70387805fa65fa1f2ac Mon Sep 17 00:00:00 2001 From: air Date: Sun, 4 Oct 2026 17:55:41 -0700 Subject: [PATCH 6/6] Budget late closes against the larger of launch and cancel screen counts A monitor connecting mid-launch can make the launcher open for more screens than were counted at launch, and a monitor dropping out shrinks the count at cancel. Use the larger of the two so neither case leaves a window open. --- shell/plugins/services/idle/Service.qml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shell/plugins/services/idle/Service.qml b/shell/plugins/services/idle/Service.qml index f6efcc929958..e590a8323507 100644 --- a/shell/plugins/services/idle/Service.qml +++ b/shell/plugins/services/idle/Service.qml @@ -128,7 +128,11 @@ Item { var owned = IdleModel.addressesToClose(root.ownedScreensaverWindows) if (root.screensaverStartedThisCycle) { root.closeLateScreensaverWindows = true - root.lateScreensaverWindowBudget = IdleModel.lateWindowBudget(root.launchScreenCount, owned.length) + // The launch may have opened for more screens than it started with (a + // monitor connected mid-launch), or fewer (one dropped out), so budget + // against the larger of the two counts. + var screens = Math.max(root.launchScreenCount, Quickshell.screens.length) + root.lateScreensaverWindowBudget = IdleModel.lateWindowBudget(screens, owned.length) lateScreensaverWindowTimer.restart() } closeScreensaverWindows(owned)