Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions manual/13-toggles-idle-screensaver.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ If you dismiss the screensaver before the lock deadline, that counts as activity

To stop locking on idle entirely, `Super + Ctrl + I` — or `omarchy toggle idle` — flips stay awake on, and the coffee cup indicator appears in the bar. That's the one to hit before a long presentation or a build you want to watch. Hit it again to go back to normal. `omarchy toggle idle status` prints the current state as JSON if you need it from a script.

A huge timeout isn't the same as "never". Both values are capped at 2147483 seconds (about 24.8 days), the longest delay the shell's timers can hold, so a giant number still locks eventually. Use stay awake if you never want the idle lock.

This is about locking and the screensaver, not power. Suspend and hibernation have their own setup in [system sleep](36-system-sleep.md).

### The screensaver
Expand Down
6 changes: 5 additions & 1 deletion shell/plugins/services/idle/IdleModel.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// Qt Timer intervals are signed 32-bit milliseconds. Anything larger wraps
// negative, Qt clamps it to 1 ms, and the shell logs a warning every tick.
var MAX_TIMER_SECONDS = Math.floor(2147483647 / 1000)

function secondsFromConfig(value, fallback) {
var n = Number(value)
if (!isFinite(n) || n < 0) return fallback
return Math.floor(n)
return Math.min(Math.floor(n), MAX_TIMER_SECONDS)
}

// 0 means the action is disabled, not "fire immediately". min(0, 300) would
Expand Down
3 changes: 3 additions & 0 deletions test/shell.d/idle-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ const serviceSource = fs.readFileSync(root + '/shell/plugins/services/idle/Servi
assertEqual(idle.secondsFromConfig('42.9', 10), 42, 'idle floors configured seconds')
assertEqual(idle.secondsFromConfig('-1', 10), 10, 'idle rejects negative seconds')
assertEqual(idle.secondsFromConfig('nope', 10), 10, 'idle rejects invalid seconds')
assertEqual(idle.secondsFromConfig(999999999, 10), 2147483, 'idle caps seconds to the largest Timer interval')
assertEqual(idle.secondsFromConfig(2147483, 10), 2147483, 'idle keeps the largest Timer interval')
assertEqual(idle.secondsFromConfig(2147483 * 1000, 10) * 1000 <= 2147483647, true, 'idle seconds never overflow a Timer interval')
assertEqual(idle.secondsFromConfig(0, 300), 0, 'idle keeps an explicit zero timeout')
assertEqual(idle.firstIdleTimeout(150, 300), 150, 'idle uses the sooner of screensaver and lock')
assertEqual(idle.firstIdleTimeout(0, 300), 300, 'idle ignores a disabled screensaver when computing first idle')
Expand Down