Skip to content

Leave a locked session's display to the lock screen - #9152

Open
Pillumz wants to merge 1 commit into
omacom:quattrofrom
Pillumz:fix/idle-no-wake-while-locked
Open

Pillumz wants to merge 1 commit into
omacom:quattrofrom
Pillumz:fix/idle-no-wake-while-locked

Conversation

@Pillumz

@Pillumz Pillumz commented Aug 30, 2026 •

Copy link
Copy Markdown

What happens

Lock the session and let the lock screen blank the display. Later the panel comes back on at the lock screen with nobody at the machine, and stays on until someone touches the keyboard or mouse. On an OLED that is the lock screen burning in for hours. omarchy debug idle shows idle-monitor: active → idle-cycle-cancel: activity → process-start: wake omarchy-system-wake, while an evdev witness on every input device saw nothing all night.

Why

The idle service treats its IdleMonitor resuming as user activity and runs omarchy-system-wake. That monitor respects inhibitors, and Hyprland resumes inhibitor-aware idle notifications without any input: it re-checks idle inhibitors whenever one is created or destroyed and whenever a window maps, unmaps or takes focus, and every re-check restarts those timers and sends resumed to an idled one (src/protocols/IdleNotify.cpp: setInhibit() → update() → reset()), whether or not anything ends up inhibited. So a video starting, a browser taking a wake lock on a background workspace, or any window opening or closing counts as activity.

Unlocked that is harmless. Locked it lights the panel, and the lock screen only re-arms its blank for input that reaches its own surface, so nothing blanks it again.

Fix

While the session is locked the display belongs to the lock screen, so the wake asks the compositor first: cancelIdleCycle() runs if omarchy-hyprland-session-locked; then exit 75; else omarchy-system-wake; fi, and the wake's exit handler logs 75 as wake-skipped: session-locked. Unlocked or undetermined, it wakes exactly as before, and the cycle ends either way. omarchy-hyprland-session-locked is the helper omarchy-restart-shell and the lock service's stranded-lock check already use.

The first version of this PR read the lock state in-process through shell.firstPartyServiceFor("omarchy.lock"). Since 1702cf0 the auth services live in AuthServiceStore and are never published to ShellRoot._services, so that lookup returns null and the guard always read unlocked: on a live machine omarchy-shell idle status said sessionLocked: false while omarchy-shell lock status said locked: true, secure: true, and the panel woke behind the lock. Its fixture registered a fake lock straight into _services, so its test stayed green on a dead feature. This version drops the in-process lookup, the sessionLocked status field and IdleModel.wakeAfterIdle.

Why this layer, unchanged from the first version: re-blanking in the lock screen would still flash the panel; refusing inside omarchy-system-wake while locked would break the lock's own wake, which runs the same command; and respectInhibitors: false would bring the screensaver back over video playback.

Proof

Nested Hyprland 0.56.2 with a real WlSessionLock held on it, the real idle Service.qml (screensaver after 5 s), and the real omarchy-system-wake, omarchy-brightness-display and omarchy-hyprland-session-locked. The trigger is a foot window opening and closing, with no input at all.

  • Before (the first version, rebased): idle-cycle-cancel: activity → process-start: wake omarchy-system-wake, and DPMS goes from off to on behind the lock.
  • After, locked: the same trigger logs wake-skipped: session-locked, and DPMS stays off.
  • After, unlocked: the same trigger runs the wake, and DPMS goes from off to on, as today.

Tests

test/shell.d/idle-lock-wake-test.sh replaces the old fixture. It loads the real Service.qml in a throwaway quickshell and stubs only the boundary: omarchy-hyprland-session-locked answers locked, unlocked or undetermined, and omarchy-system-wake records its runs. The wake runs for unlocked and undetermined and never while locked. Against the first version it fails. The existing idle and lock tests pass.

@Pillumz
Pillumz force-pushed the fix/idle-no-wake-while-locked branch from 0ddddb3 to 194e57c Compare August 30, 2026 11:36
Pillumz added a commit to Pillumz/omarchy that referenced this pull request Sep 4, 2026
The lock service blanks the display with a one-shot five-second timer that is
re-armed only by input reaching the lock surface or by a password check
finishing. Hyprland lights DPMS on its own for any pointer motion or key
press (mouse_move_enables_dpms, key_press_enables_dpms), and when that input
produces no event on the lock surface - one stray sensor count from a mouse
at 03:29, in the captured case - the spent timer stays spent and the panel is
on until someone touches the machine. On an OLED that is the lock screen
burning in overnight.

Listen to ext-idle-notify while locked, the protocol the idle service already
uses, and re-arm the blank on every resume unless a password check is in
flight. Inhibitors are not respected here on purpose: a monitor that respects
them treats one appearing as activity, which is the wake omacom#9152 proposes
removing from the idle service. The monitor's timeout is shorter than the blank countdown so it
is already idle by the time the display goes dark and the next input is a
transition it reports.

The change never runs the wake and never shortens anything, so the worst a
spurious resume can do is delay a blank by five seconds; slow panels are no
worse off than before.

Log the blank when its process starts and the re-arm when the timer was
spent, and expose blankArmed and activityIdle on `omarchy-shell lock status`;
until now the shell logged nothing about display state at the lock screen.

The five-second budget and the monitor re-add after an HPD drop (omacom#7749,
omacom#8580) are separate defects and untouched.
@v1b3m

v1b3m commented Sep 14, 2026 •

Copy link
Copy Markdown

One gap in the "cannot strand a display" enumeration, from a clamshell machine - though having tested it, the gap argues for this PR rather than against it.

The list of independent owners assumes the output is still there to be lit. In clamshell (lid shut, external only, eDP-1 disabled) after a blank, HDMI-A-2 goes to w:0 h:0 while the kernel still reports the connector connected with 35 modes available. A 2-second recorder trace of one blank:

08:09:36  HDMI-A-2  2560x1440  dpms:false    blanked
08:09:38  FALLBACK, HDMI-A-2 gone            the monitor drops its link
08:09:44  HDMI-A-2  w:0 h:0  dpms:true  lock=true/false
08:09:44  .. 08:10:25+   stuck at w:0 h:0, locked but never secure

Then:

  • realScreenCount() is 0 (plugins/lock/Service.qml:40-50), so the lock never secures and the lock surface never exists - its click and key handlers and finishUnlock are unreachable rather than merely delayed.
  • key_press_enables_dpms and mouse_move_enables_dpms have no mode to drive, so a keypress lights nothing.
  • The clamshell reconciler can only hyprctl reload, and per the comment in omarchy-hyprland-monitor-watch a reload while the monitor is unpowered leaves it at 0x0.

So the owners that remain are exactly the ones this PR removes.

What that does not mean is that keeping the idle service's wake would rescue this state. dpms:true and w:0 h:0 hold at the same time - the output is enabled with no mode to drive, so any DPMS-restoring wake is a no-op. The panel is dark for want of a mode, not for want of DPMS. If anything that argues for the PR: the owner being removed is not the owner that matters here.

What this state wants is an owner of its own - something that re-applies a mode (hl.monitor(...) via hyprctl eval) to an output reporting 0x0, where recover_modeless only reloads. Flagging it because the argument as written reads as covering all cases, and this is one where none of the listed owners apply.

Pillumz added a commit to Pillumz/omarchy that referenced this pull request Sep 18, 2026
The lock service blanks the display with a one-shot five-second timer that is
re-armed only by input reaching the lock surface or by a password check
finishing. Hyprland lights DPMS on its own for any pointer motion or key
press (mouse_move_enables_dpms, key_press_enables_dpms), and when that input
produces no event on the lock surface - one stray sensor count from a mouse
at 03:29, in the captured case - the spent timer stays spent and the panel is
on until someone touches the machine. On an OLED that is the lock screen
burning in overnight.

Listen to ext-idle-notify while locked, the protocol the idle service already
uses, and re-arm the blank on every resume unless a password check is in
flight. Inhibitors are not respected here on purpose: a monitor that respects
them treats one appearing as activity, which is the wake omacom#9152 proposes
removing from the idle service. The monitor's timeout is shorter than the blank countdown so it
is already idle by the time the display goes dark and the next input is a
transition it reports.

The change never runs the wake and never shortens anything, so the worst a
spurious resume can do is delay a blank by five seconds; slow panels are no
worse off than before.

Log the blank when its process starts and the re-arm when the timer was
spent, and expose blankArmed and activityIdle on `omarchy-shell lock status`;
until now the shell logged nothing about display state at the lock screen.

The five-second budget and the monitor re-add after an HPD drop (omacom#7749,
@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
The idle service runs omarchy-system-wake whenever its idle monitor reports
activity during a cycle it started. While the session is locked that is the
wrong reflex: the lock screen already lights the panel for input that reaches
it and blanks it again five seconds later, and the idle monitor resuming is
not evidence of input there. Hyprland makes the monitor resume with nobody at
the machine: it re-checks idle inhibitors whenever one is created or
destroyed and whenever a window maps, unmaps or takes focus, and every
re-check restarts inhibitor-aware timers and sends "resumed" to an idled one
(IdleNotify.cpp, setInhibit() -> update() -> reset()), whether or not
anything ends up inhibited. So a video starting, a browser taking a wake lock
on a background workspace, or any window opening or closing behind the lock
counts as activity, the panel lights, and nothing blanks it again - on an
OLED that is the lock screen burning in overnight.

Reading the lock state in-process no longer reaches the lock: since 1702cf0
the auth services live in AuthServiceStore and are never published to
ShellRoot._services, so firstPartyServiceFor("omarchy.lock") returns null
and the guard the original version of this change added always read
unlocked. Ask the compositor instead, at wake time, through
omarchy-hyprland-session-locked - the same helper omarchy-restart-shell and
the lock service's stranded check use. Locked (exit 0) the wake skips itself
with exit 75, which the process exit handler logs as
"wake-skipped: session-locked"; unlocked and undetermined wake exactly as
before. The cycle itself still ends; only the display is left alone.

The fixture test stubs only that boundary now: omarchy-hyprland-session-locked
answers from a file the fixture flips, omarchy-system-wake records a run
instead of lighting a display, and the real Service.qml drives all three
compositor answers. The old fixture registered a fake lock straight into
_services - the registry this change no longer reads - so it stayed green on
a dead feature; its unit cases and source-text assertions went with it.
@Pillumz

Pillumz commented Sep 28, 2026

Copy link
Copy Markdown
Author

Reworked and rebased onto quattro. The in-process lock lookup this PR relied on went dead with 1702cf0 (the lock service moved into AuthServiceStore), so the guard always read unlocked and the panel still woke behind the lock. The wake now asks the compositor through omarchy-hyprland-session-locked instead. While chasing it I also found a second trigger: Hyprland restarts inhibitor-aware idle timers on every window map and unmap, so any window opening or closing behind the lock woke the panel too. The description has the details and a nested before/after run.

@omarchybot

Copy link
Copy Markdown
Collaborator

This pull request was not reviewed in this pass, and nothing from it was run. Omabot classifies every item with two models before working it: Claude Opus 5.5 reads this as a bug fix, but the second opinion (Codex Medium) could not be asked, because the day's budget of reviewer calls was already spent. With only one model's reading the classification is unsettled, so the review, the reproduction on a worker and the test run all wait for it rather than going ahead on one opinion.

Nothing is needed from you. The next pass with reviewer budget left classifies it again at this head (4097f02) and works it from there.

@boschb

boschb commented Oct 20, 2026

Copy link
Copy Markdown

Same sequence on Omarchy 4.0.4-1, Hyprland 0.56.2, Quickshell 0.3.1-1, Framework Laptop 13 AMD Ryzen AI 300, laptop panel plus a USB-C OLED.

Locked since 19 Oct 23:39 PDT. At 20 Oct 01:16:49 PDT the idle monitor started a cycle while already locked, the screensaver command exited 0 immediately, and at 01:17:47 it logged idle-monitor: active, idle-cycle-cancel: activity, and process-start: wake omarchy-system-wake. Both panels then stayed on the password screen until 02:49. The Goodix reader had just reset and started a new verify, and it is not an input device. A failed password at 02:49:36 blanked them once, through the lock screen's own wake, and unlock was 02:50:02.

That matches the wake this PR skips. I have not applied it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants