Repository navigation
Conversation
Number(null), Number(false) and Number("") are all 0, so the three most
intuitive spellings of "off" made the screensaver or the lock fire the
instant the session went idle. -1 and "off" fell back to the default
instead, so a user who tried to turn locking off silently kept it.
Distinguish unset from explicitly disabled: null, false, "off"/"never"
and negative numbers now disable a timing, an omitted or unparseable
value still falls back to its default, and 0 still fires immediately.
The disabled timing is skipped when the idle cycle starts rather than
being pushed out to a huge interval, and the idle monitor only arms at
timings that are still enabled.
Also clamp timings to 2147483 seconds. Timer.interval is a signed 32-bit
millisecond count, so larger values wrapped and fired immediately -- the
opposite of what a long timeout asks for.
Asserts the config surface against a real installed desktop: each spelling of "off" reports the disabled sentinel and leaves the screensaver alone, an oversized timing clamps to the timer ceiling, and an omitted one still falls back to its default. The idle-cycle assertions need the compositor to actually report idle. Headless VMs do not, so they skip rather than fail for a reason unrelated to the timings.
|
Heads up on an overlap I should surface rather than leave for a reviewer to find. #7578 (opened Aug 20) already fixes the int32 overflow behind #7506, and it got there first. I only came across it today while reading through what else referenced #7506. This PR reached the same clamp independently — the disable work needed the same ceiling to be safe, so it fell out of the change rather than being the goal of it. We landed on the same line in return Math.min(Math.floor(n), 2147483)I've left
Maintainers' call entirely. One thing worth keeping whichever way it goes: #7578 includes a test asserting that both timeouts actually reach the timers through |
|
@voglster thanks for the comment mentioning my previous PR. Appreciated the acknowledgement and well written. Thanks again. -MB |
|
Following the merge of #12538, Zero now disables each action independently, settling the disable-value case. This PR also fixes the actual timer overflow reported in #7506, which remains unfixed. Leaving it open for that remainder; drop the superseded disable semantics and compare the overflow portion with #7578. Scope checked by GPT-6 in Codex and Codex Medium against the discussion and landed change; review independence is not guaranteed. No tests were rerun for this cleanup. Omabot on behalf of DHH |
Closes #7178
Closes #7506
The problem
idle.screensaverandidle.lockin~/.config/omarchy/shell.jsonhave no way to say "off", and the values that look like off do the opposite. The parser issecondsFromConfig()inshell/plugins/services/idle/IdleModel.js:Number(null),Number(false)andNumber("")are all0, and a0timing means fire the moment the session goes idle. Behaviour onquattrobefore this PR:nullNumber(null) === 0falseNumber(false) === 0""Number("") === 0-1"off"999999999So the three most intuitive spellings of "off" lock the screen instantly, and the next two silently keep the default — the user thinks it worked until they get locked out mid-task. Both timings share the parser, so
"screensaver": nulllaunches the screensaver instantly too.The overflow is separate:
lockDelaySeconds * 1000feeds a QMLTimer.interval, a signed 32-bit millisecond count (max 2147483647 ms ≈ 24.8 days). Anything above that wraps and can fire immediately — again the opposite of intent.Real case that surfaced it: a stationary desktop that should never idle-lock, but still needs the screensaver and monitor blanking for burn-in. The only workaround today is
"lock": 604800— 7 days, picked to stay under the 32-bit ceiling.The change
Distinguish unset from explicitly disabled:
null,false,"off","never"(also"none","no","disabled"), and negative numbers → disabled, via aDISABLED_SECONDS = -1sentinelundefined,true,"", and unparseable strings → existing default, unchanged0→ still 0, still fires immediately — deliberately left alone, since changing it would be a behaviour changeMAX_SECONDS = 2147483A disabled timing is skipped when the idle cycle starts rather than pushed out to a huge interval, so its
Timeris never started at all.firstIdleTimeout()arbitrates which timing arms theIdleMonitor, ignoring disabled ones, and the monitor itself is disabled when both are off."lock": falsenow does what it reads as: screensaver and monitor blanking keep working, the session never locks.Judgement calls
""falls back to the default rather than disabling. It's listed above as one of the "looks like off" values, but an empty string reads more like unset than a deliberate choice, and defaulting is the conservative side of a security-relevant decision — a stray empty value shouldn't silently stop a laptop locking. Documented as unset.0left as-is. It's a valid, if unusual, "lock immediately" and some config could rely on it. Changing it would be the behaviour change this PR is trying to avoid.enabledinidle statusstill means stay-awake. I added separatescreensaverConfigured/lockConfiguredbooleans rather than overloading it, soomarchy-debug-idleand the runtime smoke test's.enabled | type == "boolean"check are unaffected. The numericscreensaver/lockfields keep their type and report-1when disabled.No behaviour change for any config that works today.
Testing
test/shell.d/idle-test.shcovers the whole table at the parser level — each disabled spelling, the unset fallbacks,0staying immediate, the clamp, andfirstIdleTimeout()including the both-disabled case../test/clipasses.test/acceptance.d/idle-test.shis new and covers the config surface on a real desktop. I ran it in the disposable VM (omarchy-iso-testagainst the publishedomarchy-4.0.1.iso, which is the version this was reported from), with localshell/synced in:Reverting just
IdleModel.jsandService.qmlto theirquattroversions in that same VM fails the test on its first assertion, and reproduces the bug on a real installed system —"lock": falseyields:{"lock": 0, "lockDelay": 0}lockDelay: 0islockSystem("lock-timeout-immediate")the moment the session goes idle.What the acceptance test does not cover
The idle-cycle assertions — screensaver launches, lock timer never arms, session stays unlocked across a real idle transition — skip in that VM, because the shell's
IdleMonitornever reports idle there. That is pre-existing and unrelated to this change: with plain{"screensaver": 2, "lock": 300}and no disabled value anywhere, the shell still never goes idle in the guest, while a standalone QuickshellIdleMonitorwith the same 2s timeout idles immediately in the same session. So the test skips rather than failing for a reason that has nothing to do with the timings, and those assertions will run on a machine whose session does idle. Worth a second pair of eyes from someone who can reproduce a real idle transition.