Skip to content

Keep the key that wakes a dark lock screen out of the password - #9211

Open
phedoreanu wants to merge 2 commits into
omacom:quattrofrom
phedoreanu:lock-wake-after-resume
Open

phedoreanu wants to merge 2 commits into
omacom:quattrofrom
phedoreanu:lock-wake-after-resume

Conversation

@phedoreanu

@phedoreanu phedoreanu commented Aug 30, 2026 •

Copy link
Copy Markdown

Summary

The key pressed to wake a dark lock screen went straight into the password field, so the first unlock attempt failed on a stray character.

The lock now records that it turned the displays off (displaysBlank, set by runBlank(), cleared by runWake() and by the resume relight) and hands that to the view. A key pressed while the panel is dark asks for the wake and is consumed, the way hyprlock behaves. The view reads the flag before it asks for the wake, since the wake clears it.

While the displays are off the lock also polls hyprctl monitors -j every 3 s and clears the flag once a display reports DPMS on, so a panel relit behind the lock's back, by a hotplug or a bound key, does not eat the first key. An answer that lands after the poll has stopped is dropped.

This PR used to carry a second change, waking the panel on its own after resume. quattro does that itself since eb7cfd0, so that commit is gone and the PR is the fix alone.

Verification

  • test/shell.d/lock-wake-key-test.sh loads the real LockView.qml and Service.qml under Quickshell with the display commands stubbed, and checks the view's decision and every way the service sets and clears the state. With the resume relight's clear removed, it fails.
  • The other lock-* tests pass.
  • The same change has run as a cloned lock plugin on two laptops across many suspend cycles: keys hit at a dark panel no longer land in the password field.

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 8fbd1db, and both fixes work as described. Nothing to change.

I tested it on an Omarchy worker VM running this branch's shell, under Hyprland. I reproduced both problems on the base commit (f38eb42) and checked that this head fixes them:

  • Panel stays dark after resume. I locked the session and waited for the lock to blank the panel. Then I froze the shell for 12 s and resumed it, which stands in for a suspend. A real rtcwake freeze never returned on the VM. On base the panel was still DPMS-off 3 s later. On this head it was back on, and the lock logged resume-detected.
  • Wake key typed into the password. With the panel blanked, I sent a and then Return. On base the a went into the field and was submitted, so PAM logged an authentication failure. On this head the key woke the panel and was consumed, and no password was submitted. A key typed once the panel is lit still reaches the field, so normal typing is unaffected.

The lock, sleep, system-lock, video-background and monitor-recovery shell tests pass on the worker, and so does ./test/cli. The new lock-wake-after-resume-test.sh only checks that the code is present; the behaviour is covered by the reproduction above, not by that test. The change is small and in proportion to the two problems.

This fixes the wake-key half of #12398. It does not fix that issue's other cause, auto-repeat from the held lock shortcut, so I have not linked it to close.

Claude Opus 5.5 did this review. There was no second opinion: the configured reviewer, Codex Medium, refused because its daily review budget was spent. The verdict above is one model's reasoning plus what the worker showed. Until a second review runs, this is waiting on that review and then on the maintainer.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 4, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Following the merge of #7806, The merged repeat filter fixes password-field flooding. Automatic wake after resume and consuming the first wake key remain separate work. The reported stale displaysBlank regression also needs fixing; rebasing onto the repeat filter alone is insufficient.

Scope checked by GPT-6 in Codex and Codex Medium against the discussion and landed change; review independence is not guaranteed. No tests were rerun for this cleanup.

Omabot on behalf of DHH

@phedoreanu

Copy link
Copy Markdown
Author

Rebased onto quattro with #7806 in. The auto-repeat drop keeps its place at the top of the key handler; the wake-key swallow follows it, still judged before the wake clears the state. Automatic wake after resume and consuming the first wake key are the two things left in this PR.

The stale displaysBlank case, the one #11858's review described, is addressed in a second commit. The view already reads the flag through screenBlank(), which prefers Hyprland's report over what the lock asked for, but that report was only ever polled under a video wallpaper. With a static wallpaper a panel relit behind the lock's back, by a resume that kept its outputs or by a hotplug, left the flag stale and the first password key was eaten until the lock's own wake ran. The poll now also runs while the lock has blanked the panel and stops with the wake, so the swallow follows what the panel actually does. lock-wake-after-resume-test.sh checks the handler order and the poll condition; lock-autorepeat-test.sh still passes here under a compositor.

@phedoreanu
phedoreanu force-pushed the lock-wake-after-resume branch from 8fbd1db to eb7f6db Compare October 4, 2026 17:41
@greptile-apps

greptile-apps Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge, with a short remaining window where typing after an outside wake can lose the first character.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with a short remaining window where typing after an outside wake can lose the first character.

Findings

  1. P2 First password character disappears ▶

Summary

Keeps the key that wakes a dark lock screen out of the password field.

  • The lock consumes the key that wakes a dark screen.

phedoreanu acknowledged one remaining case in the supplied reply, but did not describe it there.

Reviews (6) · Last reviewed commit: "Clear the blank state after outside inpu..." · Reviewed by Greptile

Comment thread shell/plugins/lock/Service.qml Resolved
Comment thread shell/plugins/lock/Service.qml Resolved
@omarchybot omarchybot removed the bug Something isn't working label Oct 7, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Classified again at eb7f6db, by Claude Opus 5.5 and Codex Medium separately. The two disagree, so the bug label has come off until that is settled.

Claude Opus 5.5 reads it as a bug fix: the first unlock after resume fails because the key that wakes a dark panel lands in the password field, and the review of 8fbd1db reproduced that on a worker. Codex Medium reads it as an enhancement. The change also adds new behaviour on purpose: the lock now relights the panel by itself after resume, and a key pressed at a dark panel is now consumed the way hyprlock does it. Which reading is right decides how it is reviewed: a fix is reproduced against quattro, while a feature waits for the maintainer to say they want it.

Because of that, the new head has not been run on a worker or given a second review yet. The verification in the earlier comment was done at 8fbd1db and does not carry over to eb7f6db.

I read the source for Greptile's first finding on the new commit, and the race it describes is real. If a hyprctl monitors poll is still running when the panel is woken on a static wallpaper, the poll timer stops. The late answer then records the panel as dark, and nothing polls again to correct it. The next key is consumed, and that key's own wake clears the stale state. So it costs one keystroke, and only when a wake lands during the poll's few milliseconds.

This waits on the maintainer, to decide whether this is a fix or a feature they want.

@phedoreanu

Copy link
Copy Markdown
Author

Greptile's race is closed in the commit just pushed: applyMonitorDpms ignores an answer that lands while the poll timer is off, so a poll caught mid-flight by the wake can no longer record the panel as dark. The test checks for it.

On fix versus feature: the wake-key swallow is the fix, for the unlock that fails after resume because the key that lights the panel lands in the password field, reproduced on the worker at 8fbd1db. The automatic relight after resume is the part that adds behaviour. If the maintainer would rather take the fix on its own, I will split the relight into a separate PR; say so and it is done.

@zoan37

zoan37 commented Oct 10, 2026 •

Copy link
Copy Markdown

Tested a port of this to Omarchy 4.0.4 on an ARM Chromebook (Lenovo IdeaPad Slim 3, MediaTek MT8189, s2idle) today:

  • A key pressed at the blanked lock screen only wakes it, and the panel comes back on its own after resume. Both work well.
  • One small change I needed: with systemctl suspend from an unlocked session, the lock is requested and the machine is asleep within the same second, before resumeWatchTimer has ticked, so lastTick is still 0 and the resume isn't detected. Starting the clock when the timer starts fixes it: onRunningChanged: lastTick = running ? Date.now() : 0.
  • Not covered (and I don't think it's meant to be): when a key press wakes the machine from sleep, that key can reach the password field. On this hardware the EC reports the key after resume, by which time the panel is lit again, so displaysBlank is already false. I tried swallowing the first key for a couple of seconds after a detected resume; it works but it's a timing guess, so I dropped it. A clean fix would compare the key event's own timestamp with the resume time, which the QML key event doesn't expose as far as I can tell.

Thanks for the PR!

@phedoreanu

Copy link
Copy Markdown
Author

Thanks @zoan37, that is a real gap and your fix is in the commit just pushed. systemctl suspend from an unlocked session locks and sleeps inside the same second, so the resume watch had never ticked and its clock was still zero on resume. It now starts the clock when the watch starts, the same way the fingerprint sleep watch on quattro does, and the test asserts it.

The third case you describe, a key that wakes the machine itself and reaches the field once the panel is already lit, is outside what this PR can do: the QML key event carries no timestamp to compare against the resume, and a timed swallow after resume would be a guess, as you found. Left as is.

@omarchybot

Copy link
Copy Markdown
Collaborator

Classified again at 732f4dd, by Claude Opus 5.5 and Codex Medium separately, and the two still disagree: Claude Opus 5.5 reads it as a bug fix, for the first unlock after resume failing because the key that lights a dark panel lands in the password field, while Codex Medium reads it as an enhancement, because the lock now also relights the panel on its own after resume, which is new behaviour on purpose. So it carries no class label, and the new head has not been run on a worker or given a second review; the verification at 8fbd1db does not carry over.

I read the two commits since eb7f6db against the source. applyMonitorDpms now returns while monitorDpmsTimer is stopped, so a hyprctl monitors answer that lands after a wake on a static wallpaper is dropped rather than recording the panel as dark, which closes the race described in the previous comment. resumeWatchTimer now starts its clock when it starts running, so a systemctl suspend from an unlocked session that locks and sleeps inside the first second is still seen as a resume. Both read correctly; neither has been run.

This waits on the maintainer to decide whether it is a fix, or a feature they want. The author has offered to split the automatic relight into its own pull request, which would leave the wake-key swallow here as a plain bug fix.

DanteCpp pushed a commit to DanteCpp/omarchy that referenced this pull request Oct 16, 2026
The lock blanks its panels a few seconds after locking. Hyprland turns them
back on for any key (key_press_enables_dpms) and still hands that key to the
focused password field, so the key pressed only to see the screen became the
first password character and the next attempt failed.

The view already knows its panel is blank. A key pressed while it is, and the
auto-repeats of that key if it is held, now request the wake and are
swallowed; the next key is typed. Text an input method commits while blank is
dropped the same way, since it never passes Keys.onPressed. A lit lock types
every key as before.

Same approach as the view change in omacom#9211.
DanteCpp pushed a commit to DanteCpp/omarchy that referenced this pull request Oct 16, 2026
Suspend freezes the shell, so a lock that blanked its panel before sleep still
thinks it is blank after resume, even though the panel is usually lit again.
The first password key would then be swallowed as a wake key. A one-second
timer runs while locked; the first tick after resume sees the wall clock jump
and runs the wake, which clears the blank state and re-arms the blank timer.

Same as the resume watch in omacom#9211.
@phedoreanu
phedoreanu force-pushed the lock-wake-after-resume branch from 732f4dd to 48465d9 Compare October 26, 2026 12:48
@phedoreanu

Copy link
Copy Markdown
Author

Rebased onto current quattro (58858ae). #15289 replaced the playing lock video with a still poster and took out displaysBlank, screenBlank() and the hyprctl monitors poll this PR built on, so that part is rebuilt on its own:

  • The service sets displaysBlank in runBlank() and clears it in runWake(), and passes it to the view. The view swallows a key pressed while it is set, after the auto-repeat drop from Drop key auto-repeat in the lock screen password field #7806.
  • While the lock has the displays off, it polls hyprctl monitors -j every 3 s and clears the flag once a display reports DPMS on, so a panel relit behind its back stops eating the first key. An answer that lands after a wake has stopped the poll is ignored.
  • The resume relight is now its own commit, so it can be dropped or split off without touching the swallow if you only want the fix.

All lock-* tests pass, including lock-blank-fingerprint from #15294. sleep-lock-test.sh fails one case, "warns that the session was left unlocked", and fails the same way on a clean quattro checkout.

@omarchybot

Copy link
Copy Markdown
Collaborator

Classified again at 48465d9, after the rebase onto quattro, by Claude Opus 5.5 and Codex Medium separately. They still disagree, so this carries no class label. Claude Opus 5.5 reads it as a bug fix: the first unlock after resume fails because the key that lights a dark panel lands in the password field. Codex Medium reads it as an enhancement, because the lock also relights the panel by itself after resume, which is new behaviour on purpose.

I read the rebuilt diff against the source. The branch still merges cleanly with current quattro (175e63b). The wake-key swallow and the resume relight are now separate commits, 9296105 and 48465d9, so the relight can be dropped without touching the swallow. Because the class is unsettled, this head has not been run on a worker or given a second review. The worker verification at 8fbd1db was done before #15289 rewrote this code, so it does not carry over.

Two related pull requests touch the same code:

This waits on the maintainer. The choice is whether to take the wake-key swallow as a fix, and whether to take the relight with it or split it off, which the author has offered to do.

@phedoreanu
phedoreanu force-pushed the lock-wake-after-resume branch from 48465d9 to 26a1991 Compare November 25, 2026 13:56
@phedoreanu phedoreanu changed the title Wake the lock screen on resume and keep wake keys out of the password Keep the key that wakes a dark lock screen out of the password Nov 25, 2026
@phedoreanu

Copy link
Copy Markdown
Author

Rebased onto current quattro (61a1476), and the PR is smaller for it. eb7cfd0 on quattro now lights the panel after a resume, which is what this PR's second commit did, so that commit is dropped and one commit is left: the wake-key swallow. That should also settle the fix-or-feature question, since nothing here adds behaviour on purpose any more. Title and description are updated to match.

Two changes in the remaining commit:

  • The resume relight on quattro starts the wake process directly, not through runWake(), so it now clears displaysBlank too. Without that the first key after a resume would have been swallowed at a lit panel.
  • The test only read source text, which Remove tests that only read source text #16334 retired. It is replaced by lock-wake-key-test.sh, a Quickshell fixture that loads the real view and service with the display commands stubbed. To make the view's decision callable, the key handler now goes through a small takeWakeKey() function next to dropsAutoRepeat().

lock-wake-key, lock-autorepeat, lock-fingerprint-service, lock-state, lock-appear-budget and lock-poster pass.

Comment on lines +820 to +826
Timer {
id: displayStateTimer
interval: 3000
repeat: true
running: root.lockRequested && root.displaysBlank
onTriggered: {
if (!displayStateProcess.running) displayStateProcess.running = true

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.

P2 First password character disappears

Pressing a bound key such as Volume Up wakes the display without calling runWake(). Until the next three-second poll, displaysBlank stays true. Typing a password immediately afterward silently drops its first character, so the correct password fails. Clear the state when that outside wake happens, rather than relying only on the next poll.

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.

Handled in b9d7c2d for the input cases. A bound key like Volume Up, or the pointer, now clears the blank state once that input has settled for 150 ms without reaching the lock view. A display that arrives while locked clears it too. One case is left, and I explain why in the PR conversation.

Comment thread test/shell.d/lock-wake-key-test.sh Resolved
@omarchybot omarchybot added the bug Something isn't working label Nov 25, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

At 26a1991b848506b9593e172b734720e05fba7290, the ordinary wake-key fix works, but an outside wake still loses the first password character. This needs an author revision before it can be verified.

I ran the branch under Hyprland on a disposable Omarchy worker and compared it with base 61a1476f2eeef1f65577b4a9370f2d69a96ebd5d:

  • Lock, wait for DPMS-off, press a: base inserts one dot; this head leaves the field empty. Reverting the fix brings the dot back.
  • Lock, wait for DPMS-off, enable DPMS externally, immediately type abc: base shows three dots; this head shows two. Service.qml:824 only reconciles outside wakes every three seconds, so LockView.qml:208 consumes the first character while displaysBlank is stale. This confirms Greptile's current first-character finding. Please handle the outside wake before ordinary password input resumes, and cover that transition with a real key-input check.

The CLI suite and lock-wake-key, lock-autorepeat, lock-fingerprint-service, lock-state, lock-appear-budget and lock-poster tests passed on the worker. The wake-key fixture passes despite the outside-wake regression: it calls takeWakeKey() and feeds display-state answers directly. Please also put its fixture call in an existing lock test, as the base branch's test guidance requires, rather than adding another wrapper.

GPT-6 High in Codex performed the source review and worker checks. The separate classification by deepseek-v4p1-flash agrees this is a bug fix now that the additional resume-wake change is gone. The Opus 5.5 High source review ended without a report; its subsequent availability check succeeded, but no second source review completed. No commits were pushed, and verified and ready have not been added.

The captures below show masked input only. They establish the two input transitions on a virtual display, not physical suspend or monitor timing.

Ordinary wake, base: a becomes one dot.

Base: the wake key appears as one password dot

Ordinary wake, head: the same key leaves the field empty.

Head: the wake key leaves the password field empty

Outside wake, base: abc becomes three dots.

Base: three typed characters produce three dots after an outside wake

Outside wake, head: abc becomes two dots.

Head: three typed characters produce only two dots after an outside wake

When the lock has turned the displays off, the key that wakes the panel
also landed in the password field, so the first unlock attempt after a
blank failed on a stray character. The lock now records when it blanked
the displays, and the view consumes a key pressed while they are off,
after asking for the wake.

The state is cleared by the lock's own wake and by the resume relight.
While the displays are off the lock also asks Hyprland for their real
state, so a panel relit behind its back, by a hotplug or a bound key,
stops eating the first key; an answer that lands after the poll has
stopped is dropped.
Hyprland lights the panel for any key or pointer motion and says nothing
when it does, so a bound key like Volume Up or a nudge of the pointer
left the panel lit while the lock still took the next typed key for the
wake key. An idle monitor that runs only while the lock has the displays
off now notices that input, and once it has settled for 150 ms without
reaching the lock view the blank state is cleared. A key typed at the
lock reaches the view first and is handled there as before. A display
that arrives while locked comes up lit, so it clears the state too.

The fixture now types real key events into the lock view tied to the
real service, and its call moves into lock-autorepeat-test.sh.
@phedoreanu
phedoreanu force-pushed the lock-wake-after-resume branch from 26a1991 to b9d7c2d Compare November 27, 2026 07:45
@phedoreanu

Copy link
Copy Markdown
Author

Revised in the commit just pushed, after the 25 November run.

What changed. Hyprland lights the panel for any key or pointer motion, so the outside wakes a user can cause are input. While the lock has the displays off, an idle monitor now watches for input. A key typed at the lock reaches the view at once and is the wake key, as before. Any other input, such as a bound key like Volume Up or the pointer, clears the blank state once it has settled for 150 ms, so the keys typed after it all reach the field. A display that arrives while locked comes up lit, so it clears the state too. A blank started while a settle is pending cancels the settle.

What is left. A DPMS change made without input, such as hyprctl dispatch dpms on from a script, is still seen only by the 3 s poll, so a key typed within those 3 s is taken for the wake key. That is the exact case in the worker run, so it would still show two dots for abc. I don't see a way to close it from the lock as things stand. Hyprland 0.56 reports DPMS changes only to wlr-output-power clients (dpmsChanged feeds OutputPower.cpp), with no IPC or Lua event, and Quickshell has no output-power client. Closing it would mean adding a small wlr-output-power watcher, and I would rather not add that much for a scripted wake followed by immediate typing unless the maintainer wants it.

Tests. The fixture now types real key events through QtTest into the real LockView.qml, tied to the real Service.qml with every display command stubbed. It checks that the wake key is not typed, that abc after an outside wake gives abc, that a display reported lit or still off is handled either way, and that a new blank is not undone by earlier input. Each check fails when its fix is taken out. The call now lives in lock-autorepeat-test.sh, as AGENTS.md asks. lock-autorepeat, lock-fingerprint-service, lock-state, lock-appear-budget and lock-poster pass.

@omarchybot

Copy link
Copy Markdown
Collaborator

At b9d7c2d80542ba2752a88462145c985b1770cfad, the ordinary wake key is consumed correctly, but two outside-input paths still put the wrong character in the password. I prepared and tested a local fix; nothing has been pushed because its final source review did not complete.

On a disposable Omarchy worker running this branch under Hyprland 0.57.2, I used a persistent Linux uinput device to check the real compositor input path:

  • Volume Up immediately after DPMS-off, then abc about 410 ms later, produces only two dots. Keeping the input monitor armed for the whole lock fixes this: the local candidate preserves all three characters. A newly created wtype keyboard passed this case, so that alone was not adequate evidence.
  • A right-click after blanking leaves DPMS off, but the settle timer clears displaysBlank anyway. The following wake key then appears as a dot. The local candidate queries DPMS after outside input and preserves the flag while the panel remains dark. It also waits for the blank command to finish before querying; a controlled slow-blank fixture catches that race.

The existing wake-key fixture now checks pre-blank idle monitoring, non-waking activity and delayed blanking. These checks fail without the corresponding changes. The CLI suite and seven focused lock suites passed on the candidate; the final timer guard also passed the focused key-input fixture. The original wake-key bug was reproduced on base a11b6a60 and with the fix reverted, while this branch leaves the field empty.

The scripted DPMS-on case in your reply remains: typing abc before reconciliation produces two dots, including on the local candidate. The 150 ms input-settle interval also remains a timing trade-off. These scope decisions are with the maintainer. Related #16449 implements the same wake-key guard on dev.

GPT-6 High in Codex performed the source and worker checks. Opus 5.5 High contributed the two reproduced input mechanisms; muse-wonder via pi, thinking high also reviewed this head. The follow-up Opus review returned a further timing finding, but its runner exited 143 without a completed review record. A subsequent availability check succeeded, so this was an incomplete review, not an unavailable reviewer. No verified or ready label has been added. This waits on the maintainer for completion of the candidate review and the remaining scope decision.

These captures compare the current branch with the unpublished candidate. They show masked input on a virtual display, not physical monitor or suspend timing.

Current branch: immediate Volume Up then abc loses its first character

Local candidate: the same early Volume Up transition preserves abc

Current branch: after a non-waking right-click the wake key types a dot

Local candidate: the wake key after that right-click leaves the field empty

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.

3 participants