Conversation
The lock surface is created before Hyprland maps it and hands over keyboard focus, so the single forceActiveFocus() from Component.onCompleted landed while the window was still inactive and never re-applied. Focus is also dropped on suspend/resume, after the idle screensaver dies, and when a failed password re-enables the field. Retry until the field holds focus; the timer's running binding re-arms on every later focus loss, and idles while the display is blanked so a surface that can never take focus (monitor hotplugged mid-lock) does not spin all night. Fixes omacom#6858
csfh
left a comment
There was a problem hiding this comment.
The comment in the implementation is unnecessarily long.
I am wondering if it wouldn't be better to resolve the underlying problem in shell.
paulogeyer
left a comment
There was a problem hiding this comment.
+1 for #12587.
Verified test/shell.d/lock-focus-retry-test.sh green on PR head (3/3); stock tip lacks the focus-retry Timer. Matches the DPMS-blank → wake path: timer idles while displays are blank, then retries forcePasswordFocus() until the password field has keyboard focus — so typing works without a click after wake, without flipping global mouse_refocus.
Prefer this over the mouse_refocus = false workaround and over stale #7471. Complements #12435 for the suspend/resume focus path.
Verified on my laptop (ASUS Vivobook, Intel Arc)Live soak of the LockView focus-retry
Stock tip fails this path (one-shot Structural harness +1 — prefer this over draft #12614 for the DPMS-blank-while-locked case: surface stays mounted, so window Non-blocking follow-ups (optional before or after merge)
Not a substitute: global |
|
Automated duplication check: this pull request looks similar to #8560, which covers the same lock focus restore on resume. I keep that one open and close this one to consolidate review. If you feel this is the wrong decision, please open the PR again with a note on the difference. |
Problem
The Quickshell lock screen password field does not auto-focus. After locking (cold lock, idle timeout, or suspend/resume), typing does nothing until the field is clicked. Reported as #6858 (and #7467).
Root cause
LockView.qmlgrabbed focus once withQt.callLater(forcePasswordFocus)fromComponent.onCompletedandonInputEnabledChanged. TheWlSessionLockSurfaceis created before Hyprland maps it and hands over keyboard focus, so that single grab lands while the window is still inactive and is never re-applied when the surface activates. Focus is also lost again, with nothing to reclaim it, in three further paths:inputEnabled(lockRequested) stays true across it, so neither hook re-fires;authenticatingPasswordclears.Fix
Replace the single-shot grab with a retry timer whose
runningbinding keys off focus state, so it re-arms on every later focus loss:The
!root.displaysBlankterm idles the timer while the display is blanked. That bounds the one surface that can never converge — a monitor hotplugged mid-lock has a nullscreenand cannot win keyboard focus however many times it is asked — so it does not spin at 10 Hz for the whole lock.Verification
qmllintonLockView.qmlis clean.test/shell.d/lock-focus-retry-test.shasserts the retry invariant.lock-password-overflowandlock-fingerprint-indicatortests that load and instantiateLockView.qmlin a live Quickshell process.Notes
LockView.qmlwon't pick this up automatically; that is inherent to cloning.