Repository navigation
Wake the lock screen on resume and keep wake keys out of the password - #9211
phedoreanu wants to merge 2 commits into
Conversation
b873fe6 to
8fbd1db
Compare
|
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:
The lock, sleep, system-lock, video-background and monitor-recovery shell tests pass on the worker, and so does 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. |
|
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 |
|
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 |
8fbd1db to
eb7f6db
Compare
[Medium impact] The PR appears safe to merge, with two non-blocking concerns from the previous review still open. FindingsSummaryThe lock now wakes displays after a detected resume and consumes the first key when it believes the displays are blank.
Reviews (4) · Last reviewed commit: "Wake the lock screen on its own after re..." · Reviewed by Greptile |
| var resumed = lastTick > 0 && now - lastTick > interval + 2000 | ||
| lastTick = now | ||
| if (resumed) { | ||
| root.logEvent("resume-detected") | ||
| root.runWake() |
There was a problem hiding this comment.
Clock delays wake displays A gap of more than three seconds between timer callbacks is treated as a resume even when the machine has not slept. If the event loop stalls or the wall clock moves forward while the lock is blanked, this calls
runWake(), lights the unattended display, and restarts its blank countdown.
| assert( | ||
| /id: monitorDpmsTimer[\s\S]*?running: root\.locked && \(root\.videoBackground \|\| root\.displaysBlank\)/.test(serviceQml), | ||
| 'the panel state is polled while the lock has blanked it, whatever the wallpaper' | ||
| ) | ||
|
|
||
| // Resume is detected from the clock jump the frozen shell sees on its first | ||
| // tick back, and the panel is woken without waiting for input. | ||
| assert( | ||
| /id: resumeWatchTimer[\s\S]*?running: root\.lockRequested[\s\S]*?now - lastTick > interval \+ 2000[\s\S]*?if \(resumed\) \{[\s\S]*?root\.runWake\(\)/.test(serviceQml), | ||
| 'the lock wakes the panel on its own after resume' |
There was a problem hiding this comment.
Tests miss wake behavior These assertions match QML text but never exercise a timer tick, DPMS result, or key event. They can pass despite the wake and polling order producing the wrong behavior, while a harmless rewrite of the matched expressions can fail the test. Behavioral checks using the existing QML fixture approach would cover the blank-to-wake transition and resume timing.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Classified again at 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 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 I read the source for Greptile's first finding on the new commit, and the race it describes is real. If a This waits on the maintainer, to decide whether this is a fix or a feature they want. |
|
Greptile's race is closed in the commit just pushed: 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. |
|
Tested a port of this to Omarchy 4.0.4 on an ARM Chromebook (Lenovo IdeaPad Slim 3, MediaTek MT8189, s2idle) today:
Thanks for the PR! |
|
Thanks @zoan37, that is a real gap and your fix is in the commit just pushed. 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. |
|
Classified again at I read the two commits since 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. |
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.
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.
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 video poll that used to reconcile this with Hyprland is gone since the lock shows a still poster, so the lock asks Hyprland for the real display state while it has them off. A panel relit behind its back, by a hotplug or a resume that kept the outputs on, then stops eating the first key, and an answer that lands after a wake has stopped the poll is dropped.
A suspend freezes the shell, so the first tick after resume sees the clock jump. The lock now wakes the panel then, instead of leaving the user at a dark lock screen pressing keys to bring it back. The clock starts when the watch starts, so a suspend from an unlocked session that locks and sleeps inside the first second is still seen as a resume.
732f4dd to
48465d9
Compare
|
Rebased onto current
All |
|
Classified again at I read the rebuilt diff against the source. The branch still merges cleanly with current 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. |
Summary
Two things made the first unlock after resume slower than it needed to be:
displaysBlank, set byrunBlank(), cleared byrunWake(), on unlock, or when a display comes back) and hands that to the view: a key pressed while the panel is dark requests 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.test/shell.d/lock-wake-after-resume-test.shpins both behaviours.Verification
bash test/shell.d/lock-wake-after-resume-test.shand the existinglock-*,sleep-*andsystem-locktests (68 passing)