Skip to content

Refocus the lock password field after resume - #7592

Closed
RovshanMuradov wants to merge 1 commit into
omacom:quattrofrom
RovshanMuradov:fix/lock-resume-keyboard-focus
Closed

RovshanMuradov wants to merge 1 commit into
omacom:quattrofrom
RovshanMuradov:fix/lock-resume-keyboard-focus

Conversation

@RovshanMuradov

@RovshanMuradov RovshanMuradov commented Aug 20, 2026 •

Copy link
Copy Markdown

Problem

After suspend, the lock screen shows the password field but keystrokes do nothing until any mouse click. The keyboard is alive; Qt activeFocus on the field is not.

Reproduce

  1. Lock, then suspend (or suspend, which locks first).
  2. Wake.
  3. Type immediately, without clicking.
  4. No dots. Click anywhere, then the same keys appear.

Why v3 worked

Omarchy 3 locked with hyprlock, which reads raw Wayland keys. Quattro (7ea4e1a Switch hyprlock to QS) replaced that with a Quickshell TextInput. Focus is set on Component.onCompleted, inputEnabled, and click. The lock stays mapped across suspend, so onCompleted never runs again. Click already called forcePasswordFocus(); nothing else did.

Fix

While the lock is up, idle, and the field has no activeFocus, a short timer calls the same forcePasswordFocus() path as a click. Stops once the field is focused; does not run during PAM.
Verified: suspend → wake → type with no click.

The lock surface stays mapped across suspend, so onCompleted never runs again. Resume drops Qt activeFocus; a click already restored it.
Copilot AI balanced review requested due to automatic review settings August 20, 2026 08:52

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

Restores password-field focus after resume by retrying focus while the lock screen is idle.

Changes:

  • Adds a repeating focus-recovery timer.
  • Pauses retries during password authentication.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.


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

Comment on lines +85 to +86
running: root.inputEnabled && !root.authenticatingPassword && !passwordInput.activeFocus
onTriggered: root.forcePasswordFocus()
notTanveer added a commit to notTanveer/omarchy that referenced this pull request Aug 22, 2026
The refocus fired once, from `Qt.callLater` on the blanked flag going
false. That flag clears the moment `runWake()` is called, before
`omarchy-system-wake` has even started, let alone before Hyprland has
re-enabled DPMS and handed the lock surface its keyboard focus back. The
call therefore lands on a display that is still off, and nothing tries
again: on hardware slower to return focus than this one, the wake lights
the panel and the field stays deaf anyway.

Retry instead, on a short timer bound to the field's own `activeFocus`,
so it stops itself the moment focus lands. It idles while the display is
blanked, where there is no focus to win and a lock can sit for hours.

omacom#7592 fixes the same early-focus problem from the resume side with the
same shape of timer, minus the blanked gate. If that lands first, this
one should go.
@IgorKonovalov

Copy link
Copy Markdown

Tested the retry-timer approach from #7592 on the current stable release: it fixes the resume case here, and a focus trace shows where the focus is lost.

Setup: Omarchy 4.0.4-1, Hyprland 0.56.2-2, aquamarine 0.15.0-2, quickshell 0.3.1-1, kernel 7.2.5. ASUS ROG Zephyrus G15 (GA503QS), single internal eDP on the AMD iGPU (Cezanne, amdgpu), RTX 3080 idle via PRIME offload. Password-only lock (fingerprint reader unsupported). Suspend via lid close (s2idle).

Symptom on stock 4.0.4: after lid-open resume the password box is shown, but typing does nothing until the box is clicked. Reproduced 4 of 4 times.

Patch tested: in LockView.qml, a 250 ms repeating Timer that calls forcePasswordFocus() while inputEnabled && !passwordInput.activeFocus (same idea as #7592), plus logging of passwordInput.activeFocus and Window.active.

Trace from one cycle (journal):

08:19:47.631 lock-requested
08:19:48.133 field-focus=true
08:19:48.180 secure=true
08:19:48.181 window-active=true field-focus=true
08:19:48.338 kernel: PM: suspend entry (s2idle)
08:19:48.579 field-focus=false
08:19:48.579 window-active=false field-focus=false   <- libseat "Disabling seat"; keyboard removed
08:19:49.045 field-focus=true                        <- retry timer re-grabbed focus
08:19:58.666 kernel: PM: suspend exit
08:20:11.114 pam session started (password typed without clicking)

The lock window goes inactive when the seat is disabled for suspend, and activeFocus does not come back when it is re-enabled. Window.active never logged true again, so a handler on window activation alone would not have caught it. The retry timer did. Stock 4.0.4 has nothing that re-asserts focus after this point, which matches the diagnosis here and in #12435.

Hyprland's log for the same resume also shows drm: Cannot commit when a page-flip is awaiting twice, cleared by the next modeset right away. That is not what blocks input here.

@chessing234

Copy link
Copy Markdown
Contributor

hey, this is already covered in #12894 (lock keyboard focus after resume). mind closing this as a duplicate?

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed this against #12435, which fixes the same bug a different way. Both work; #12435 is the one I've recommended to the maintainer.

Reproduced on a disposable Omarchy VM (Hyprland, Quickshell, this PR merged into quattro at de63134). The test: lock the screen, switch VT away and back, then type the password without clicking. The VT switch makes libseat disable the seat, so every keyboard is removed and re-added the same way suspend does it. On quattro alone the typed password never reaches the field after the VT switch (no PAM session starts, 2 of 2 boots), while the same typing without the VT switch unlocks. With this PR it unlocked 6 of 6 times, and with #12435 also 6 of 6. A focus trace with this PR shows the lock window's active focus item going null at the moment the seat drops, and the timer taking focus back about 100 ms later. With two outputs locked the timer went quiet rather than polling, so I have no defect to report in this change.

Why #12435: it reacts to that exact transition (the window's active focus item becoming null) instead of retrying on a 100 ms timer, and it adds a regression test (test/shell.d/lock-focus-reclaim-test.sh). This PR's timer covers a little more in principle, such as focus moved to some other non-null item, but I found no path in the lock UI that needs it. #12894, mentioned above, was closed and targeted the docked clamshell reload path, so it does not cover this case.

Codex (medium) was asked separately which of the two to bring forward, and also chose #12435, for the same reasons. It found no defect in either. Its independence from this review is not guaranteed. Claude Opus 5.5 did the review and the VM testing.

Which of the two lands is the maintainer's decision, so this waits on them. Nothing is needed from you in the meantime.

@omarchybot

Copy link
Copy Markdown
Collaborator

Thank you for this, @RovshanMuradov. #12435 fixes the same problem in a way the review judged better, so this is closed in favour of it. If it does not cover your case, please say so there.

Closed at the maintainer's request. The review comment above has the details; it was done by Claude Opus 5.5 with Codex Medium as a second opinion, whose agreement is not independent.

@omarchybot omarchybot closed this Oct 1, 2026
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.

5 participants