omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Lock screen password field doesn't have keyboard focus until clicked

Open r3d3n0d0 opened this issue 3 months ago • 7 comments

What happened

After the session locks (idle timeout or manual lock), the password field on the lock screen does not have keyboard focus. Typing does nothing until I click into the field first. This happens consistently, every lock/unlock cycle.

What I expected

The password field should already have keyboard focus when the lock screen appears, so I can start typing the password immediately without clicking.

Steps to reproduce

  1. Lock the session (omarchy system lock, or let idle.lock trigger it).
  2. As soon as the lock screen appears, start typing the password without clicking anywhere.
  3. Nothing is entered into the field. Click into the field, then typing works.

Likely cause

shell/plugins/lock/LockView.qml already tries to auto-focus the field:

Component.onCompleted: {
  syncPasswordText()
  if (inputEnabled) Qt.callLater(forcePasswordFocus)
}
onInputEnabledChanged: {
  if (inputEnabled) Qt.callLater(forcePasswordFocus)
}

inputEnabled is bound to root.lockRequested in Service.qml, which is set true immediately in beginLock() — at the very start of the lock sequence, before the Wayland session-lock surface actually has compositor keyboard focus. Journal output from Service.qml's own event log shows the gap between the two:

18:37:33.031Z lock-requested
18:37:33.031Z lock-pending: screen-stabilizing
18:37:33.580Z secure=true          <- ~550ms later

forcePasswordFocus() fires (via Qt.callLater) right at lock-requested, well before secure=true — i.e. before WlSessionLock.secure confirms the compositor has actually granted the surface keyboard focus. The QML-level forceActiveFocus() call succeeds against the item, but doesn't correspond to real Wayland keyboard focus yet, so it's a no-op in practice. Clicking the field afterward re-triggers forcePasswordFocus() via the MouseArea, which works because by then the surface is actually focused.

A fix would be to move (or also trigger) the auto-focus call off onSecureStateChanged (when secure becomes true) rather than only off inputEnabled, or add a short retry similar to the existing sessionLockStabilizeTimer pattern already used for the analogous "wait for the compositor to settle" problem elsewhere in Service.qml.

System details

  • Omarchy: 4.0.1-1
  • Hyprland: 0.56.2
  • Quickshell: 0.3.1
  • Kernel: 7.1.9-arch1-2
  • Session: Wayland, single monitor (eDP-1, scale 1.5)
  • GPU: Intel TigerLake-LP Iris Xe (i915) + NVIDIA GTX 1650 Ti Mobile (nvidia) — hybrid graphics laptop

omarchy debug --no-sudo --print is unavailable on this install — there's no debug subcommand registered despite omarchy --help listing it as a common command (Unknown Omarchy command: omarchy debug). Diagnostics above were gathered manually instead.

r3d3n0d0 avatar Aug 31 '26 02:08 r3d3n0d0

Just a reminder to use the search feature in Github.
I think it would be more helpful to consolidate the open issues and PRs instead of opening new ones.

I found 5 open PRs to address this:

  • https://github.com/omacom/omarchy/pull/7164
  • https://github.com/omacom/omarchy/pull/7592
  • https://github.com/omacom/omarchy/pull/8560
  • https://github.com/omacom/omarchy/pull/8869
  • https://github.com/omacom/omarchy/pull/9181

And at least 9 open isses:

Image

BreitbandModem avatar Aug 31 '26 08:08 BreitbandModem

Triaged against quattro (v4.0.0-235-gb686ed89). Your diagnosis is right, and the mechanism is provable — it turns out to sit one layer below where you were looking, in Quickshell itself.

Two corrections to the ordering first. beginLock() sets lockRequested = true at shell/plugins/lock/Service.qml:135, but the next line's queueSessionLock() only starts a 500 ms sessionLockStabilizeTimer (Service.qml:434-439); sessionLock.locked = true is not set until that timer fires (Service.qml:76). So at the moment inputEnabled flips there is no LockView in the lock surface yet, and onInputEnabledChanged (LockView.qml:71-73) never runs for it. The handler that actually fires is Component.onCompleted (LockView.qml:74-77). That accounts for the 500 ms gap in your trace.

Now the part that makes it a no-op. Quickshell's WlSessionLock::realizeLockTarget() (src/wayland/session_lock.cpp:115-140) does this, in one synchronous pass:

// preload initial surfaces to make the chance of the compositor displaying a blank
// frame before the lock surfaces are shown as low as possible.
this->updateSurfaces(false);

if (!this->manager->lock()) this->lockTarget = false;

this->updateSurfaces(true, old);

Read from the quickshell-git debug source; the same code path is confirmed present in the 0.3.1 binary you are running, whose strings output carries all five diagnostics from this function and its callee. updateSurfaces(false) constructs every WlSessionLockSurface and the LockView inside it — so Component.onCompleted runs, and Qt.callLater(forcePasswordFocus) is queued — before manager->lock() is called at all, that is, before the ext-session-lock-v1 request has even been sent, with the windows not yet shown. The compositor cannot have granted the surface keyboard focus at that point; that is what arrives ~50 ms later as secure=true in your log. So the field's one and only focus attempt is fired at a window that has just been made visible and does not yet hold the keyboard.

What turns that race into a permanent failure is that there is nothing to fall back on. forcePasswordFocus() (LockView.qml:55-57) is the only thing that ever focuses the field, called from exactly three places: LockView.qml:72, LockView.qml:76, and the background MouseArea.onClicked at LockView.qml:118 — your click workaround, which works because of activeFocusOnPress: true at LockView.qml:143. WlSessionLock.onSecureStateChanged (Service.qml:235-243), the one signal that means the compositor has actually granted the keyboard, starts the fingerprint PAM and never touches focus. And there is no focus: declaration anywhere in shell/plugins/lock/: LockView is a plain Item (LockView.qml:6), not a FocusScope, and passwordInput (LockView.qml:132) never sets focus: true. Every other keyboard-accepting surface in the shell declares it — shell/Ui/PanelKeyCatcher.qml:46, shell/Ui/SpeedTestOverlay.qml:107, shell/plugins/menu/Menu.qml:1120, shell/Ui/SearchableDropdown.qml:182, shell/Ui/Dropdown.qml:159, shell/Ui/MultiSelect.qml:369, shell/plugins/dev-gallery/GalleryPanel.qml:290-293. The lock is the only one that takes focus purely imperatively, which is why the outcome differs by machine: it misses on every lock for you, only after resume for #9180, and never for most people.

A third trigger came out of the second review and is worth more than either of the reported ones, because it needs no suspend and no second monitor: mistype your password once and the field stops accepting keystrokes until you click it. passwordInput.enabled is bound root.inputEnabled && !root.authenticatingPassword (LockView.qml:145); submitPassword() sets authenticatingPassword = true (Service.qml:183), which disables the item, and Qt clears activeFocus on a disabled item; handlePasswordFailure() sets it back to false (Service.qml:201) and re-enables the field, but nothing refocuses on that transition. If you can, please try it — lock, type a deliberately wrong password, press Enter, then try to type again without clicking. Whether that reproduces on your machine is useful either way.

Two smaller things. This is not new in 4.0.2 — the only change to shell/plugins/lock/ in that release is a one-line textFormat: Text.PlainText addition to the placeholder label; the behaviour arrived with the Quickshell lock in 7ea4e1ab ("Switch hyprlock to QS"), in 4.0.0. And your omarchy debug observation is a real and separate problem: bin/omarchy-debug does exist in the v4.0.1 tree and registers as omarchy debug, so an install where it is unknown is missing the file rather than mis-routing it. ls -l /usr/bin/omarchy-debug and pacman -Qo /usr/bin/omarchy-debug would show whether it landed; that deserves its own issue, since it blocks diagnosing everything else.

On the comment above: it is right that this is well covered. #7164, #7592, #8560, #8869, #9181 and #8930 all propose fixes, and they differ in whether they address the cause or refocus after the fact. Which one lands is the maintainer's decision rather than triage's, so I have not opened a competing one.

Status: explained — mechanism proven in source, not reproduced. The worker fleet had no free slots during this run, so nothing was exercised on real hardware. Reviewed by Claude Opus 5 and independently by Codex at xhigh reasoning; where the two agreed, that agreement is not fully independent, since Codex can read the first reviewer's working notes.

omarchybot avatar Aug 31 '26 12:08 omarchybot

Different machine from the reporter, but it reproduces the primary symptom, so here is the result of the mistyped-password test triage asked for.

Primary symptom: reproduces, on every lock. After resume the lock screen is visible but the password field holds no keyboard focus. Typing does nothing. The field becomes usable only when a click lands inside the field itself — consistent with activeFocusOnPress: true (LockView.qml:143) being what focuses it, rather than any forcePasswordFocus() call.

Third trigger: does NOT reproduce. Locked the screen, typed a deliberately wrong password, pressed Enter, and after the failure I could type again immediately without clicking. Focus survived the authenticatingPassword -> disabled -> re-enabled transition on this machine.

If that holds up, the two mechanisms are separable: this hardware fails only the initial focus grant (the realizeLockTarget() ordering described above), while the disable/re-enable path at Service.qml:201 keeps focus fine.

Timing note that may or may not be relevant: on 4.0.1 the field stayed unresponsive for roughly 20 seconds after resume before a click would take. After updating to 4.0.2 it is responsive to a click almost immediately. The click requirement itself never changed.

System details

  • Omarchy 4.0.2-1, kernel 7.1.9-arch1-2
  • ASUSTeK X556UQ laptop, single internal display, no external monitor
  • Intel i5-6200U (Skylake); Intel HD 520 drives the panel, NVIDIA 940MX present (muxless Optimus, nvidia-580xx-dkms 580.178.04)
  • Internal keyboard is PS/2 ("AT Translated Set 2 keyboard"), not USB
  • Hyprland via uwsm; LUKS root; no fingerprint reader configured

Single monitor and no fcitx5 here, so this is independent of #9180's multi-output path and of #9325.

Unrelated to the focus bug, but relevant to the omarchy debug remark in the triage above: on this install the file is present and correctly annotated, and the routing is what is broken — omarchy-settings binaries never get symlinked into the directory the dispatcher globs. Filed separately as #9373, since it blocks collecting diagnostics for issues like this one.

alexmirkovic99-hue avatar Aug 31 '26 14:08 alexmirkovic99-hue

Correction to my comment above: I wrote "reproduces, on every lock." That is wrong, and it puts this machine in the wrong category.

I had only ever tested locks that involved suspend. Isolating the two by setting HandleLidSwitch=ignore so a lid close locks without suspending gives the opposite result: the password field holds keyboard focus correctly. Keys land in it immediately, with the display still blank, no click needed.

17:14:47  Lid closed
17:14:47  omarchy lock  lock-requested
17:14:47  omarchy lock  lock-pending: screen-stabilizing
17:14:47  omarchy lock  secure=true            (0.6s)
17:14:55  Lid opened
17:15:01  pam session starts -> unlocked       (typed, no click)

PM: suspend entry occurrences in this window: 0

Same session, same shell process, same lock plugin — the only variable removed is the suspend/resume cycle.

So on this hardware the failure is confined to post-resume, which makes it #9180's profile ("only after resume"), not the every-lock profile. Please re-file my earlier report accordingly; the "misses on every lock" data point was mine in error, not a second machine exhibiting it.

This also narrows the mechanism rather than just correcting a label. The initial focus attempt from realizeLockTarget() evidently does succeed here — the surface holds the keyboard from creation. What fails is re-acquiring focus after a resume recreates the lock surface. That is consistent with the root cause noted in #9180: Service.qml observes Quickshell.onScreensChanged but only retries lock acquisition and never asks the recreated view to refocus.

If that holds generally, a refocus on the recreated-surface path would fix this class without touching the construction-order race, since the construction path is demonstrably working on at least this machine.

The mistyped-password result in my earlier comment stands unchanged: it does not reproduce here.

alexmirkovic99-hue avatar Aug 31 '26 15:08 alexmirkovic99-hue

Confirming this also affects my machine (Omarchy 4.0.1-1). Journal shows the identical pattern already described above:

lock-requested
lock-pending: screen-stabilizing
secure=true          (~1.3s later here)

In my case it showed up specifically after a lid-close suspend/resume cycle: waking the display and clicking generically (not directly on the password field) left the field completely unresponsive to typing, forcing a hard power-cycle since the lock screen never accepted input. This matches the focus-grab timing gap described above rather than a driver problem — the kernel-level keyboard driver (i8042/atkbd) resumes cleanly in my logs both times this happened, with no serio/atkbd errors. Clicking directly on the password field is a working workaround once the display is awake.

Ch4pt3r23 avatar Sep 04 '26 03:09 Ch4pt3r23

Same here on a Legion 5 15IRX10, Omarchy 4.0.3-1, single laptop display, no suspend involved. Every lock (omarchy system lock or the idle timer): field has no keyboard focus until I click it.

Workaround that fixed it for me, in a cloned lock plugin (omarchy plugin clone omarchy.lock), added to LockView.qml right after Component.onCompleted:

Window.onActiveChanged: {
  if (Window.active && inputEnabled) forcePasswordFocus()
}

Fires when the compositor actually activates the surface, so it lands after the existing Qt.callLater calls. Typing works immediately now. Not a PR, just a data point alongside the fixes already open.

HoneySpoons avatar Sep 13 '26 01:09 HoneySpoons

Automated duplication check: this issue looks similar to #6858, which covers the same lock screen password field loses focus. I keep that one open and close this one to keep the discussion in one place.

If you feel this is the wrong decision, please open the issue again with a note on the difference.

bjarneo avatar Sep 20 '26 20:09 bjarneo