Skip to content

Wake the blanked lock screen from the keyboard - #7471

Open
notTanveer wants to merge 4 commits into
omacom:quattrofrom
notTanveer:fix/pass-focus
Open

notTanveer wants to merge 4 commits into
omacom:quattrofrom
notTanveer:fix/pass-focus

Conversation

@notTanveer

@notTanveer notTanveer commented Aug 19, 2026 •

Copy link
Copy Markdown

Fixes #7467

all this so i don't have to reach for my mouse and do a click.

what's broken

5s into the lock the screen blanks, and omarchy-brightness-display off does a real DPMS off. hyprland takes the lock surface's keyboard focus with it and doesn't give it back when the panel comes back on.

the keyboard's only way into the lock is the password field's Keys handler, which needs that focus. hyprland lights the panel on a keypress by itself (key_press_enables_dpms), but the shell never hears the key, so runWake() doesn't run and nothing gets typed. a click works because pointer events don't care about keyboard focus, which is why plugging in a mouse fixes it in the issue.

the fix

wake from the compositor, where focus doesn't matter (Service.qml):

IdleMonitor {
  id: blankWakeMonitor
  enabled: root.lockRequested
  timeout: 1
  respectInhibitors: false
  onIsIdleChanged: if (!isIdle && root.displaysBlank) root.runWake()
}

it's armed for the whole lock, not just while blanked. the idle notification starts active and only goes idle after 1s with no input, so one armed at blank time never primes if you look back and type your password straight in. i measured that with every other wake path cut: 47 keys over 15s, no wake.

it uses the displaysBlank flag that's already on quattro.

then get focus back (LockView.qml): a short timer keeps calling forceActiveFocus() until the field has activeFocus, and does nothing while the display is blanked.

the blank timer also won't blank while the monitor still sees input. it only restarted on input the field hears, so with no focus you could be typing and it would blank under you, with nothing left for the monitor to wake on until you paused.

commits

  • 5c22c3b the monitor, the blank gate, and a refocus when the display comes back
  • e729991 a key during the blank could race it. runBlank() turns the keyboard backlight down before the DPMS off, so a wake in that gap ran against a lit display, brightness-display on skipped it (on purpose, to avoid a flash after resume), and then the blank turned the panel off behind it. now a wake that shows up while the blank is running waits for the blank to exit.
  • 55bbb88 the refocus fired once, before hyprland gives focus back. now it retries until the field has focus.
  • 2ef9433 (pushed by omarchybot) the blank's exit read a cleared displaysBlank as a held wake, but onScreensChanged clears it too, so an output coming or going mid-blank lit the lock with no input. the held wake has its own flag now, wakeHeld, and a later runBlank() drops it.

other open PRs

verification

traced on the machine that hits the issue, with temp logging around blank/wake, before the rebase. blanked, then woke it with the keyboard only:

17:32:49.300  blanked
17:32:50.301  blank-idle-monitor: isIdle=true
17:39:47.152  blank-idle-monitor: isIdle=false   <- keypress, no focus held
17:39:47.152  wake-from-blank
              lock-focus: forced -> activeFocus=true
17:39:56.644  unlocked

test/shell.d/lock-blank-wake-test.sh pins the monitor, the blank gate, the wake hold and the retry timer (6 checks), and all the lock-* tests pass at 2ef9433. i didn't rerun the full ./test/shell on 2ef9433. at 55bbb88 it failed the same tests as plain quattro (runtime-smoke is flaky there too), and omarchybot's VM run at 2ef9433 says the same.

since the rebase omarchybot traced the keyboard wake, the wake hold and the refocus on a VM at 2ef9433, traces are in the thread. the VM keeps focus through DPMS off, so it had to drop the field's focus by hand to get the issue. the blank gate hasn't been traced live at all, and none of this has been re-traced on the machine that actually hits it since the rebase.

Copilot AI balanced review requested due to automatic review settings August 19, 2026 09:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates the lock screen’s password input behavior to request focus by default.

Changes:

  • Forces focus onto the password TextInput by setting focus: true.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread shell/plugins/lock/LockView.qml Outdated
verticalAlignment: TextInput.AlignVCenter
horizontalAlignment: TextInput.AlignHCenter
activeFocusOnPress: true
focus: true

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the lock screen component only has a text input field. there are no other focusable controls.

@notTanveer notTanveer changed the title fix(lock): ensure password field auto-focuses Wake the blanked lock screen from the keyboard Aug 21, 2026
@notTanveer
notTanveer requested a balanced review from Copilot August 21, 2026 17:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread shell/plugins/lock/Service.qml Outdated
}

function runWake() {
displayBlanked = false

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, and worse than the flag being stale: omarchy-brightness-display on skips its dispatch on purpose when every active display already reports DPMS on, so the raced wake is not just early, it is a no-op. The blank then took the panel down behind it and left the monitor gated off by displayBlanked — disarmed against exactly the screen it exists to wake.

Serialized in 7d6cb90. runWake() holds the wake back while blankProcess is running, and the blank dispatches it from its own onExited, where the DPMS off it has to undo has actually landed. Covered by test/shell.d/lock-blank-wake-test.sh.

@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed at 9e1b3f3 after the rewrite. The earlier version of this branch was the one-line focus: true, and the standing finding against it was that it was a no-op. That is moot now — the mechanism is different, and it is real.

The mechanism works, proven by mutation. On a disposable VM running this branch as the live compositor, I severed every route to runWake() in LockView.qml — the MouseArea, onTextChanged, and the Keys handler — so the new IdleMonitor was the only thing left that could wake anything, and logged the blank/wake path:

12:23:07  runBlank
12:23:08  idlemonitor isIdle=true
12:23:10  idlemonitor isIdle=false      <- keypress
12:23:10  runWake displayBlanked=true

With the IdleMonitor taken back out and the same routes severed, the keypress reached nothing at all. So the monitor arms while blanked, hears the key with no focus involved, and gets to runWake() first, exactly as the description says.

Two limits on what that VM can show, both worth having. Its virtual output does not lose keyboard focus on DPMS-off, so #7467 itself does not reproduce there — I could confirm the mechanism, not the cure. And with the shell's every wake route severed, hyprctl still reported the display back on a second after the keypress, with nothing in the shell having dispatched a DPMS enable: Hyprland lights the panel itself on input, at least there. If that also holds on the reporter's hardware, the half of this that decides #7467 is the refocus rather than the wake.

One defect found and fixed, pushed to this branch as 245dded. The idle notification starts active and only reports idle after a second of quiet, and any input restarts that second. Armed only while blanked, it was deaf to precisely the user this is for: someone who looks back at a just-blanked lock screen and types their password straight in never leaves the gap the notification needs to prime. Same harness, measured: 47 keystrokes over 15 seconds, no wake at all; then a three-second pause and one more key, wake. Arming it for the whole lock and gating the wake on displayBlanked instead leaves it already idle when the blank lands, so the first key wakes the screen — re-measured on the same VM, first key, no pause needed.

Two things left open, for the maintainer rather than for me:

  • The onDisplayBlankedChanged refocus in LockView.qml is a single Qt.callLater fired when the flag flips, not when the wake actually completed. If Hyprland has not yet handed the surface its keyboard focus back by then, that call lands too early and nothing retries. I could not test it — the VM never loses the focus in the first place — and it is the one part of this that has to win a race on the affected hardware.
  • runBlank() and runWake() both set displayBlanked before their processes finish, so a wake arriving in the short window while the blank process is still running can leave the display off with the flag false and the monitor disarmed. The five-second blank timer heals it while the lock is up. The underlying blank/wake overlap predates this PR; what is new is the monitor going quiet during it.

Related work. #7592 and #7164 fix the focus half by other routes — #7164 refocuses when WlSessionLock reports secure, #7592 retries until the field actually holds focus — and #6642 attacks the same ground by not blanking at all. Only this PR restores the display; only #7592 is robust to a refocus that lands early. Which to take is the maintainer's call, and none of the others were touched.

Second opinion. Codex at xhigh reviewed this independently and got to the priming hole before I did: I had reasoned about the arming condition and the flag race but not about the notification starting active, and its reading is what sent me to measure the thing. That finding stands on its own. It agreed on the flag/DPMS race, and on that point its independence is not currently guaranteed. It found no conflict between this monitor and the one in services/idle, and no problem with respectInhibitors: false here.

Tests. On the worker, against the pushed commit: the full ./test/shell suite, 2263 passed, 0 failed. Nothing was run on the machine holding credentials.

Waiting on the maintainer to choose between this and #7592/#7164/#6642, and on you for the refocus timing if you can still reproduce it.

@notTanveer

Copy link
Copy Markdown
Author

Both open items are fixed, and the priming finding in 245dded is a good catch — that one would have shipped broken for the exact user the PR is for.

The refocus timing. You read it right: the flag clears at the top of runWake(), before omarchy-system-wake has started, let alone before Hyprland has re-enabled DPMS and handed the surface its focus back. The single Qt.callLater landed on a display that was still off. It took on this machine, which is why the original trace shows activeFocus=true, but nothing retried, so that was luck rather than design. e5b5567 replaces it with a timer bound to the field's own activeFocus, which stops itself the moment focus lands, and idles while blanked — there is no focus to win with the output down, and a lock can sit blanked all night.

That is the same shape as #7592, minus the blanked gate. Noted in the description: if #7592 lands first, the timer here should go and only the Service.qml half of this PR is needed. Nothing in #7592 touched.

The flag/DPMS race. Fixed in 7d6cb90, and the mechanism is a little sharper than "the wake may observe a lit display": omarchy-brightness-display on skips its dispatch by design when every active display already reports DPMS on, to keep a redundant modeset from flashing the panel after resume. So a wake that overtakes the blank is not merely early, it is a no-op — and then the blank takes the display down behind it, with displayBlanked false and the monitor disarmed. runWake() now holds the wake back while blankProcess is running and the blank dispatches it from its own onExited, where the off has actually landed. You are right that the overlap predates this PR; it is worth closing here anyway, since the monitor is what makes the dark-with-flag-false state stick.

Tests. test/shell.d/lock-blank-wake-test.sh covers both, and fails against the tree without them. ./test/shell: 182 files, the same three pre-existing environment failures (config, snapper, unowned-system-paths) with and without the change.

Not re-traced live. The shell on the affected machine runs from the packaged tree, so neither fix has been re-traced there yet — they are reasoned from source and covered by that test. Worth a live trace before merge if the refocus timing is what decides it; I can still reproduce the original blanked-lock deadlock here.

On your VM's second observation — Hyprland lighting the panel itself on input, with every shell wake route severed — that matches what I see: the display coming back is not the hard part, the focus is. If that holds generally, then yes, the refocus is what decides #7467, and the wake here is what makes it deterministic rather than dependent on the compositor doing it.

@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed at e5b5567. Both open findings are fixed, and both fixes are now traced on a live compositor rather than reasoned from source: a disposable Omarchy VM running this branch as the session shell, with a sleep 2 inserted into the blank process so a keypress can be placed inside its window deliberately instead of by luck. The real blank is 100-300ms wide; everything below reproduces at that width too, just less reliably. Timestamps are seconds from the first line of each trace.

7d6cb90 — the wake/blank race. Fixed, and it was worse than either of us wrote down.

Reverting only the two lines of 7d6cb90 and pressing a key 145ms into the blank:

+0.000  runBlank
+0.145  runWake blankRunning=true                    <- keypress, dispatched anyway
+0.225  wake.sh dpms-before=true dpms-after=true     <- no-op, display still lit
+2.022  blank.sh done dpms=false
+2.027  blankExited displayBlanked=false
        display stayed off for the remaining 8s of observation

With the gate back in, same harness, key 28ms into the blank:

+0.000  runBlank
+0.028  runWake blankRunning=true                    <- keypress, held back
+2.041  blank.sh done dpms=false
+2.051  blankExited displayBlanked=false             -> dispatch
+2.249  wake.sh dpms-before=false dpms-after=true    <- lit again

So the mechanism is exactly as you described it: dpms-before is the whole finding, and holding the wake back is what turns it from true into false.

The part worth adding is that unlock() calls runWake() too, so the same race lands the unlocked desktop dark, with the lock surface already gone and nothing armed to bring it back. Password typed, Return pressed 2ms into the blank, unfixed:

+0.000  runBlank
+0.002  runWake blankRunning=true                    <- Return
+0.076  wake.sh dpms-before=true dpms-after=true
+2.022  blank.sh done dpms=false
        submit+1s through +8s: locked=false, dpms=false

Authentication succeeded, the lock went away, and the screen stayed black. Fixed, same timing:

+0.000  runBlank
+0.002  runWake blankRunning=true                    <- submitPassword
+0.054  runWake blankRunning=true                    <- unlock
+2.020  blank.sh done dpms=false
+2.026  blankExited                                  -> dispatch
+2.096  wake.sh dpms-before=false dpms-after=true

That failure predates this PR — runWake() on quattro is the same unguarded line — so 7d6cb90 is worth having for the unlock path alone, independently of the monitor it was written for.

e5b5567 — the refocus retry. Fixed.

The VM's virtual output never loses keyboard focus on DPMS-off, so I took it away by hand instead: an instrumented LockView drops passwordInput.focus on a 1.2s cycle while the lock is up.

+0.000  dropFocus
+0.001  activeFocus=false
+0.102  activeFocus=true

Three for three, 101ms each, which is the timer's own interval. With the timer removed and the same drop, activeFocus=false was the last thing logged — the field never got focus back for the rest of the lock. The retry does what the commit message says it does.

One thing still open, and it is the same terminal state by a narrower route

Codex at xhigh, asked to enumerate the interleavings at this head, worked out that blankProcess.onExited drops the held-back wake when a wake process happens to still be running:

onExited: if (!root.displayBlanked && !wakeProcess.running) wakeProcess.running = true

runBlank() does not guard on wakeProcess.running, so a blank can start under a wake that has not exited. If that wake is still running when the blank exits, the !wakeProcess.running guard suppresses the dispatch — and the wake it defers to has already done its one DPMS enable, before the blank's off. I reproduced it by making omarchy-system-wake linger for 10s:

+0.000   runWake -> wakeProcess starts, held open 10s
+5.049   runBlank
+5.051   runWake blankRunning=true wakeRunning=true   <- keypress, held back
+7.069   blank.sh done dpms=false
+7.074   blankExited displayBlanked=false             <- wake still running: held wake dropped
         display off, displayBlanked false, monitor disarmed
+10.053  runBlank re-arms displayBlanked

Dark screen, flag false, monitor disarmed — the state 7d6cb90 exists to prevent, five seconds long on the lock screen. On the unlock path there is no re-arm, and it is the black desktop above.

The precondition is a wake still running five seconds after it started, which is narrower than what this PR fixes, so this is not a regression: quattro loses the wake on every keypress that lands in the blank window, and this head loses it only under a wedged child. It is also not hypothetical in this file — a wake or blank child that never exits is the entire premise of #7673.

I have not pushed a fix. The obvious one is a pending-wake latch drained from both processes' exits, but runWake() is called at pointer-motion rate and its no-op-while-running behaviour is load-bearing coalescing, so a latch has to be conditional on the blank in a way that is a design choice rather than a defect fix — and #7673 deletes both Process objects the latch would hang off. Your call, and worth settling against #7673 rather than before it.

Sequencing

Your read of #7673 is right and it is the sharpest conflict here: it replaces blankProcess and wakeProcess with Quickshell.execDetached, and blankProcess.running plus onExited — the two things 7d6cb90 is built on — do not survive that. test/shell.d/lock-blank-wake-test.sh asserts on both by source text, so it fails against #7673's tree as well.

On #7592: it is the same timer minus && !root.displayBlanked. Worth noting for whoever picks between them that the gate is not only a power question. If Hyprland will not hand a lock surface keyboard focus while its output is off — which is the premise of this whole PR — then #7592's ungated timer cannot win focus while blanked and spins at 10Hz for as long as the lock sits there, and it still does not fix #7467, because a key with no focus reaches nothing. This PR's IdleMonitor needs no focus at all. I could not test that on the VM, whose output keeps focus through DPMS-off; it is reasoning from the mechanism, not a measurement.

Tests

On the worker, at e5b5567: test/shell.d/lock-blank-wake-test.sh 4 passed, and every other lock test in the suite green (lock-blank-fingerprint 4, lock-password-overflow 1, lock-stranded-recovery 14, lock-fingerprint-indicator 1, system-lock 1, sleep-lock 19). The full ./test/shell: 181 of 182 files passed, the failure being screenshot-sanity-test.sh ("top bar band looked blank"), which then hung in grim on re-run and again after a clean reboot. That is the VM's virtual output, not this branch — nothing here touches the bar — but it is a skip rather than a pass and I am not going to call it green.

Codex also noted that the new test only matches source text: it would still pass if an unconditional wake were added before the guard, or if the IdleMonitor wiring were removed. That is true of several tests in this suite and it caught nothing wrong here, but it does mean neither failure above has regression coverage.

This review was done by Claude Opus 5 with a second opinion from Codex at xhigh. Where codex agreed with conclusions already reached — the DPMS-skip mechanism, the refocus wiring — its independence is not currently guaranteed and I am not claiming it. The dropped-wake analysis is its own, and the traces above are mine.

Waiting on the maintainer for the sequencing against #7673 and #7592, and on you for whether the dropped-wake case is worth closing here or after #7673.

- Watch compositor input with an IdleMonitor so a key wakes the blanked lock screen without keyboard focus
- Arm the monitor for the whole lock so it is already idle when the blank lands
- Hold the blank while the monitor still sees input the password field never heard
- Refocus the password field when the display comes back
- Add a test pinning the monitor and the blank gate
- Hold back a wake that arrives while the blank process is still running
- Run the held wake when the blank process exits, once its DPMS off has landed
- Pin both in the blank wake test
- Replace the one-shot refocus with a timer that retries until the password field has focus
- Idle the timer while the display is blanked or a password check is running
- Pin the retry timer in the blank wake test
The blank's exit read a cleared displaysBlank as a wake held back mid-blank, but onScreensChanged clears that flag too. An output coming or going during the blank, as a connector that drops on DPMS off does, made the exit dispatch omarchy-system-wake nobody asked for, and with the blank timer already spent the lock then stayed lit until the next input. Record the held wake in its own flag instead, and let a later blank request supersede it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed after the rebase onto quattro, now at 2ef9433. I found one defect and pushed a fix for it. The bigger question here is which fix to take for #7467, and that is the maintainer's call.

What ran, and where. Everything ran on a disposable Omarchy VM, with this branch linked as the live shell. The VM's virtual output keeps keyboard focus through DPMS off, so #7467 does not happen there on its own. To reproduce it, an instrumented LockView cleared the field's focus as the blank started, which is what the affected hardware does:

  • On quattro, a keypress while blanked relit the panel (Hyprland does that itself, through key_press_enables_dpms in default/hypr/input.lua:72). runWake() never ran, and the next keys typed nothing.
  • On this branch, the keypress reached runWake() through the IdleMonitor, focus came back, and the next keys were typed.
  • With only the refocus Timer removed, the shell woke but the field stayed deaf. Both halves are needed for this branch to work.

A second output did not make the refocus timer spin: both lock surfaces held activeFocus. The lock tests all pass (lock-blank-wake 6, sleep-lock 19, lock-stranded-recovery 14 and the rest). In the full ./test/shell, 7 of 282 files fail, and the same 7 fail on plain quattro on that VM (ascii, branding-about-animation, kernel-headers-migration, network-captive-portal, omarchy-kernel-migration, passwordless-grant-lifecycle, video-background).

The defect, fixed in 2ef9433. blankProcess.onExited took a cleared displaysBlank to mean a wake had been held back mid-blank. But onScreensChanged clears that flag too. So if an output came or went during the blank, the exit ran omarchy-system-wake without anyone asking for it. The blank timer was already spent, so the lock then stayed lit until the next input. I reproduced this by widening the blank to 2s and removing an output mid-blank: this branch left the panel on with no input, and quattro left it off. The held wake now has its own flag, wakeHeld, and a later runBlank() supersedes it. After the fix, the screen-change case stays dark, a key pressed mid-blank is still held and replayed once the blank lands, and the keyboard wake above still works.

Which fix for #7467. Hyprland already lights the panel on a keypress, so what #7467 is actually missing is focus. A focus-only fix covers it:

What this branch adds on top is real: it keeps the shell's state in step with a wake Hyprland did on its own (keyboard backlight, the blank countdown, a video wallpaper), and it closes the blank/wake race. That race predates this pull request and can leave even the unlocked desktop dark until the next input. But it is a change to wake state and blank/wake ordering, not a fix for the missing focus, and it would read better as its own pull request. It also conflicts with #7673, which deletes the blankProcess and wakeProcess this ordering hangs on.

Hardware. Whichever fix lands needs confirming on a machine that loses focus on DPMS off. #7467 was opened by this pull request's author, so that confirmation has to come from someone else: the reporter of #12587, or a maintainer.

Second opinion. Codex at medium reviewed three rounds. In the first it found the screen-change interaction above, and in the second the superseded held wake. It is credited as co-author on 2ef9433, and its last round on that head found nothing blocking. Asked separately which of the competing pull requests best fixes #7467, it put #8560 first, #7592 second and this one third. It got there independently of the ranking above, though it could not read #10944, #11858 or #9523's diffs. Where it agreed with a conclusion already reached, its independence is not guaranteed.

Waiting on the maintainer: which focus fix to take for #7467, and whether the wake-state and ordering half of this branch should come back as its own pull request, sequenced against #7673.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lock Screen not focusing

3 participants