Repository navigation
Conversation
A suspend between the lock's focus request and the compositor's keyboard grab can drop the password field's focus, and nothing after the resume asks for it back: the lock surface stays shown across the sleep, so neither completion nor inputEnabled re-runs and typing does nothing until the field is clicked (omacom#15673). The lock already notices a resume as the wall clock jumping under a repeating timer (the fingerprint sleep watch); a sibling watch does the same while the lock holds the session and refocuses the field, staying out of the way of a password check in flight.
[Medium impact] The change affects the lock-screen resume and password-entry flow. The change appears safe to merge, with a non-blocking gap in the new regression test. Findings
SummaryAdds
Reviews (1) · Last reviewed commit: "lock: give the password field its focus ..." · Reviewed by Greptile |
| assert( | ||
| /Timer\s*\{\s*id: passwordFocusSleepWatch[\s\S]*?spannedSleep\(now - lastTickMs, interval\)[\s\S]*?lockView\.forcePasswordFocus\(\)/.test(serviceQml), | ||
| 'a sleep watch refocuses the password field after a resume' | ||
| ) |
There was a problem hiding this comment.
Broken timer still passes tests
The new test checks source text but never checks what the timer does. Removing repeat: true, replacing lastTickMs = now with lastTickMs = 0, or making slept always false would still pass every assertion. These changes would stop resume detection or repeatedly force focus without a resume.
Add a behavior check that feeds ordinary ticks and a sleep gap through the timer logic, then checks focus calls and both guards.
|
Thanks for this. I've read it but haven't reviewed it yet. I read it as a bug fix for #15673, but every item here gets its classification and review checked by a second model, and today's budget for that second opinion (Codex Medium) is used up, so the classification isn't settled yet. Until it is, I haven't labelled it and haven't run anything on a worker. The full review comes once the second opinion is available: a reproduction on a worker that fails on |
|
Confirming the root cause and the fix on Omarchy 7.2.8 (Hyprland, ASUS laptop, clamshell + external HDMI monitor, also reproduced with the lid open). After a real suspend/resume the password field isn't focused until clicked. A local patch equivalent to this PR (a repeating 1s Timer inside Possibly useful for the review: PR #12435 takes another approach (re-grabbing focus whenever the window's active focus item is cleared), which would also cover the case where the devices are re-added without a detectable clock jump. |
|
Tested on real hardware with lid-close S3 suspends, and it fixes the bug here. One disclosure first: this was a backport to Omarchy 4.0.6, not Machine: Lenovo ThinkPad P17 Gen 1, built-in keyboard ( Backport: the Isolation: earlier the same day I had #12435 installed on this machine (comment there). For this test I restored the stock 4.0.6
The lock was secured before each suspend ( For whoever picks between this and #12435 (same bug, #12525/#15673): both fix it on this machine, tested in isolation on the same boot. This PR refocuses on the first 1 s tick after the clock jump, which is probably before the keyboard's re-add (roughly 3 s after resume on a machine like this). It still worked here, so in practice the early |
Fixes #15673
Problem
After a suspend, the lock screen's password field no longer accepts keyboard input until it is clicked.
LockViewrequests focus only at creation and wheninputEnabledflips; Omarchy's sleep helper waits for the lock to become secure before suspending, so the compositor's suspend/resume transition happens after that request and no later event restores focus.Fix
The lock service already notices a resume as the wall clock jumping under a repeating timer (
fingerprintSleepWatchviaFingerprintModel.spannedSleep). A siblingpasswordFocusSleepWatchtimer inside theWlSessionLockSurfaceuses the same detection while the lock holds the session and callslockView.forcePasswordFocus()on the jump — refocusing an enabled field only, and never while a password PAM conversation is in flight. It lives inside the surface, so it is destroyed with it and keeps no timer ticking for an open session.Test
New
test/shell.d/lock-resume-focus-test.sh(auto-discovered bytest/shell):quattro(verified viagit stash) and passes with the changelockRequested, gates oninputEnabled && !authenticatingPassword, and is owned by the lock surfaceRelated lock tests all pass:
lock-blank-fingerprint,lock-autorepeat,lock-fingerprint-service,lock-fingerprint-retry,lock-password-overflow,lock-stranded-recovery,apply-lock, andlock-appear-budget(one cold-start budget flake reproduced neither on clean quattro re-runs nor on three re-runs with the change).