Skip to content

Lock screen: keep fingerprint idle while the display is blanked - #11273

Open
niconistal wants to merge 1 commit into
omacom:quattrofrom
niconistal:lock-fingerprint-idle-when-blanked
Open

niconistal wants to merge 1 commit into
omacom:quattrofrom
niconistal:lock-fingerprint-idle-when-blanked

Conversation

@niconistal

@niconistal niconistal commented Sep 11, 2026 •

Copy link
Copy Markdown

Problem

  • Once the lock screen blanks the display, the fingerprint PAM stays armed and fingerprintRetryTimer re-arms it after every attempt for the whole lock, even though nobody can touch the sensor with the panel dark.
  • A verify already in flight when the panel goes dark keeps holding the reader for pam_fprintd's whole timeout, then re-arms.
  • On a MacBook Pro with Touch ID through the T1Bridge fingerprint backend, a lock left blanked for hours ended with the backend wedged ("load biometric keybag failed", its relay service restarting) until a power cycle. Readers that thermally self-disable hit the same loop (see lock: re-arm fingerprint reader after a missed or errored scan #12201).

Change

  • runBlank() calls suspendFingerprint(): stops the retry and reach timers and aborts an attempt in flight. The aborted attempt is cleared directly, not settled, so it does not count toward the unreached streak. startFingerprint() and settleFingerprintAttempt() do nothing while suspended.
  • resumeFingerprint() re-arms the reader on every route the panel comes back by:
    • runWake(), including a wake that is the first keystroke of a password;
    • onScreensChanged, for a panel that comes back on its own;
    • restartFingerprintAfterSleep(), for a resume that keeps the same outputs and never reaches runWake(). This route also re-arms the blank timer and does not force the panel on, so a lid opened to a lit panel takes a finger and a dark wake blanks and suspends again after the usual 5 s.
  • The instant-failure backoff from the first revision is gone; Fix fingerprint enrollment and lock-screen recovery #7158 landed its own.

Compared with #12420

Both pause new scans while blanked and stop the retry timer. The differences:

Either would fix the T1 case. Happy to close this in favor of #12420 if maintainers prefer it, or to fold the in-flight abort into it.

Testing

  • test/shell.d/lock-blank-fingerprint-test.sh covers the suspend, the in-flight abort, every resume route and the reset at lock start; it fails on unpatched quattro.
  • All 17 lock-related tests under test/shell.d pass.
  • qmllint shell/plugins/lock/Service.qml: no new warnings against quattro.
  • Not yet run on hardware in this revision. The first revision of the blank-suspend ran overnight on a MacBookPro14,3 on 2026-09-07.

🤖 Generated with Claude Code

@hanscnelson

Copy link
Copy Markdown

Independent confirmation of both problem halves on a MacBookPro14,2 (Omarchy 4.0.3, T1Bridge Touch ID). We have not run this PR.

On this machine the lock screen already blanks after 5 seconds (idleBlankTimer). Overnight the laptop sat locked with the panel dark and no suspend (PrepareForSleep never fired). Fingerprint PAM kept running the whole time.

Rates from the journal, same omarchy-lock-fingerprint path:

  • Waiting for a finger: a new PAM session about every 31 s (fprintd’s 30 s timeout plus the 250 ms retry).
  • After the T1 keybag relay wedged (load biometric keybag failed): several PAM sessions per second, matching the instant Device reported an error during verify: fingerprint operation failed storm.

Password unlock still worked. A short Super+Ctrl+L then password-cancel is healthy today (in-flight verify cancelled); the “resume the reader on first keystroke, don’t touch the password” behaviour looks right for that.

This would have stopped the blanked-display polling and the post-wedge 250 ms loop. It would not have been a root-cause fix for the SEP/keybag wedge; that remains on the T1Bridge side.

Happy to live-test a quattro build later if useful. This install is 4.0.3, so the PR is not a drop-in here.

@niconistal

niconistal commented Sep 11, 2026 •

Copy link
Copy Markdown
Author

Thanks for the independent confirmation. Your two rates match what I saw on a MacBookPro14,3: one PAM session about every 31 s while waiting for a finger (fprintd's 30 s timeout plus the 250 ms re-arm), and several per second once the backend starts failing instantly.

On the target branch: the PR is against quattro because that is where the quickshell lock screen lives now, so you are right that it is not a drop-in on 4.0.3. I would gladly take you up on the live test on a quattro build once a maintainer has had a look.

To keep the two sides straight, since they are easy to conflate:

One more data point on recovery: on the 14,3 a full shutdown and power-on cleared the wedge. After the boot the relay did its usual single boot-time retry and has been active since.

@niconistal

Copy link
Copy Markdown
Author

First live result, on a MacBookPro14,3 running Omarchy 4.0.3 with the T1Bridge relay wedged (the reader fails every attempt instantly, the same state as the overnight reports on t1bridge#14).

How it was run on 4.0.3. The lock screen is a plugin, so no packaged file needs editing:

omarchy plugin clone omarchy.lock
# apply this PR's shell/plugins/lock/Service.qml hunks to ~/.config/omarchy/plugins/<user>.lock/Service.qml
omarchy restart shell

Six of the eight Service.qml hunks apply as-is. Two need a hand port on 4.0.3, because runWake/runBlank there have no displaysBlank/monitorDpmsKnown bookkeeping yet and onScreensChanged starts with requestSessionLock(): add resumeFingerprint() at the end of runWake, suspendFingerprint() at the end of runBlank, and root.resumeFingerprint() at the top of onScreensChanged, then the new functions themselves. Note that the lock service is keepLoaded, so saving the file hot-reloads nothing there; omarchy restart shell is required. The clone survives updates; omarchy plugin remove <user>.lock reverts. That should make it a drop-in for @hanscnelson's 4.0.3 install as well.

Observed, 27 s lock, panel blanked after the 5 s idleBlankTimer (state read via omarchy-shell lock status every 2 s, PAM starts from the journal):

  • Two instant failures before the blank: failure streak 2, retry delay 4 s.
  • At the blank the fingerprint PAM was aborted and stayed suspended for the remaining 21 s: 0 omarchy-lock-fingerprint sessions in that window.
  • On the first keypress the reader was re-armed immediately; the password unlocked as usual.
  • 6 PAM sessions for the whole lock. The stock 4.0.3 lock screen on the same wedged reader started about 80 in the same interval, and about 2.4k over a 35-minute lock earlier today.

Not a fix for the relay wedge itself (t1bridge#14), only for the lock screen hammering a reader nobody can reach.

@niconistal

Copy link
Copy Markdown
Author

For anyone on a released Omarchy who wants this before it lands: it is now an installable plugin, so no cloning or hand-patching.

omarchy plugin add https://github.com/niconistal/omarchy-quiet-fingerprint.git --enable

It does not ship a patched copy. At every shell start it reads the lock screen Omarchy has installed, applies this PR's change as anchored edits and loads the result, so Omarchy updates flow through. If the installed lock screen already contains the change it disables itself and says so; if the file changed shape so the edits no longer apply, it applies nothing, disables itself and the stock lock screen is back in charge. Registered via clonedFrom: omarchy.lock, the same mechanism omarchy plugin clone uses, so omarchy plugin remove nn.quiet-lock restores the built-in.

Verified on 4.0.3 (same 27 s lock test as above: fingerprint PAM suspended from the blank, zero sessions until the first key); the builder is also tested against the current quattro lock screen. @hanscnelson this should be the drop-in for your 4.0.3 install.

@hanscnelson

Copy link
Copy Markdown

Live test of nn.quiet-lock on the 4.0.3 drop-in, MacBookPro14,2, LG unplugged, Super+Ctrl+L (not lid). Keybag was healthy (NRestarts=0). Waited with no input; first input was the trackpad, then Touch ID.

Journal:

  • 15:24:19 lock, one omarchy-lock-fingerprint (reader armed).
  • Next fingerprint PAM: 15:25:20 — 61 s later, same second as trackpad wake. No 31 s retry while the panel was dark.
  • 15:25:24 unlocked via fingerprint. Zero omarchy-lock-password.

On the machine: laptop panel blanked; Touch Bar stayed lit on the media strip (no unlock prompt). Trackpad → unlock prompt on the bar → Touch ID succeeded.

That is the healthy-reader path: PAM stops for the blank, re-arms on first input (trackpad, not only a key), password unused. Matches the 14,3 wedged-reader result, different reader state.

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed by Claude Opus 5.5 and run on a disposable Omarchy worker. I found one defect and pushed a fix to this branch as 92b489b. The reproduction holds at that head. Codex Medium, the configured second opinion, did not run: omabot's review budget for today was spent, so nothing here has been checked by a second model yet.

Reproduction. On the worker, omarchy-lock-fingerprint was replaced with a pam_exec stub that logs each conversation and fails at once, which is the path a failing reader takes (an error result other than a plain mismatch). Then the lock was started over IPC with no input:

  • Base (quattro at b5589fa): 151 fingerprint PAM sessions in 40 s, one every ~260 ms. 130 of them came after the lock blanked the display at 5 s.
  • This branch: the first attempt fails, the next comes after the backoff, and none follow once the display blanks. A keypress woke the display and re-armed the reader within 40 ms, and the reader suspended again at the next blank.
  • An attempt that runs longer than a second (stub sleeping 1.5 s) is retried at 250 ms, as today. The attempt still in flight at the blank was aborted.

Fixed: one failure counted twice. Quickshell's PamContext::onError emits error() and then completed(PamResult.Error). Rescheduling from both onError and handleFingerprintFinished therefore counted every PAM error twice. That is the error path pam_fprintd takes when the device errors, and on the worker the first retry came after 4 s rather than 2 s. 92b489b drops the reschedule from onError (completed() already does it) and adds an assertion for that to test/shell.d/lock-blank-fingerprint-test.sh. With the fix the first retry comes after 2.0 s, as the description says.

Tests on the worker: every test/shell.d file for the lock and fingerprint (14 files, including the extended lock-blank-fingerprint-test.sh) passes at 92b489b. The extended test fails on base, at "blanking the display suspends the fingerprint". The full suite was not run. CI has not reported on this pull request.

Competing pull requests. This one overlaps with #11918 (the instant-failure backoff only), #12420 (the blank only), #12461 (stop after six attempts, with a paused message), #13819 (capped attempts, with an interval that grows for healthy mismatches too) and #10653 (backoff plus a wake on every attempt, which keeps the panel lit). This is the only one that handles both the blank and the instant-failure loop in one change. #11918 and #12420 together cover the same ground. Which to take is the maintainer's call. One trade-off is theirs to weigh: once the panel is dark, a touch on the reader does nothing until a key or the pointer wakes the display. That is the point of this change, and #12420 does the same after its in-flight scan ends.

Not yet labelled. The classification has to be re-asked after a push, and that needs the second opinion too. So this waits for the review budget to come back: then it gets the second opinion, verified and the issue links. Once merged it should fix the retry storms in #9648, #9905 and #12509. #13748's first half is the same storm, but its polkit half is not touched here.

@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 3/5

[Medium risk] Lock screen fingerprint sensor handling during display blanking.

The PR is not ready to merge because display transitions can leave fingerprint authentication in the opposite state from the panel.

Findings

  1. P1 DPMS wake leaves fingerprint suspended ▶
  2. P1 Screen changes resume blanked reader ▶
  3. P2 Input repeatedly clears retry backoff ▶
  4. P2 Tests miss display transitions ▶

Summary

The PR suspends fingerprint authentication while the lock display is blank and adds exponential retry backoff for rapidly failing readers.

  • Blanking now aborts the fingerprint conversation and stops its retry timer; wake paths resume authentication.
  • Display-state transitions are not consistently tied to suspension: DPMS wake can leave the reader idle, while a screen-list change can reactivate it during blanking.
  • Repeated lock-screen input can clear backoff, and the added tests check source patterns rather than transitions.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Display up; fingerprint armed] -->|runBlank| B[Display blank; fingerprint suspended]
  B -->|runWake| A
  B -->|DPMS reports panel on| C[Display visible; fingerprint still suspended]
  B -->|screen list changes| D[Display may remain blank; fingerprint resumed]
Loading

Reviews (1) · Last reviewed commit: "Count a fingerprint PAM error once in th..."

root.displaysBlank = true
root.monitorDpmsKnown = false
if (!blankProcess.running) blankProcess.running = true
suspendFingerprint()

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.

P1 DPMS wake leaves fingerprint suspended

If a video-wallpaper lock blanks the display and DPMS turns it back on without lock-screen input, the DPMS poll makes the wallpaper visible but does not call resumeFingerprint(). The reader stays suspended, so fingerprint unlock is unavailable on the lit screen until another input calls runWake().

// for, so the blank state has to be given up here or a visible lock
// wallpaper stays frozen until the next keypress.
root.displaysBlank = false
root.resumeFingerprint()

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.

P1 Screen changes resume blanked reader

If a monitor is plugged in or removed while the lock display remains blank, onScreensChanged calls resumeFingerprint() without checking whether the display has turned on. It can rearm PAM while the panel is still dark, and this path does not restart the blank timer to suspend the reader again.

Comment thread shell/plugins/lock/Service.qml Outdated
}

function resumeFingerprint() {
resetFingerprintBackoff()

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 Input repeatedly clears retry backoff

Lock-screen pointer movement and password input call runWake() even when the display is already on. Because resumeFingerprint() clears the failure streak before checking whether the reader was suspended, ordinary input can repeatedly restart a failing reader’s pending retry at 250 ms instead of letting its backoff grow.

Comment on lines +37 to +65
assert(
/function runBlank\(\) \{[\s\S]*?suspendFingerprint\(\)[\s\S]*?\n \}/.test(serviceQml),
'blanking the display suspends the fingerprint'
)

assert(
/function suspendFingerprint\(\) \{[\s\S]*?fingerprintRetryTimer\.stop\(\)[\s\S]*?if \(fingerprintPam\.active\) fingerprintPam\.abort\(\)/.test(serviceQml),
'suspending stops the retry timer and aborts the fingerprint PAM'
)

assert(
/startFingerprint\(\) \{\s*if \(fingerprintSuspended \|\|/.test(serviceQml),
'the fingerprint prompt does not start again while suspended'
)

assert(
/function scheduleFingerprintRetry\(\) \{\s*if \([^)]*fingerprintSuspended\) return/.test(serviceQml),
'an aborted conversation does not re-arm the retry timer while suspended'
)

// The display coming back is the only thing that brings the reader back, and
// it must survive a wake that is itself the first keystroke of a password.
assert(
/function runWake\(\) \{[\s\S]*?resumeFingerprint\(\)[\s\S]*?\n \}/.test(serviceQml),
'waking the display resumes the fingerprint'
)

assert(
/function resumeFingerprint\(\) \{[\s\S]*?if \(lockRequested && fingerprintConfigured\) startFingerprint\(\)/.test(serviceQml),

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 Tests miss display transitions

These assertions check the text of Service.qml, not what happens when display state changes. They can pass while a DPMS wake leaves fingerprint authentication suspended or a screen-list change resumes it during blanking, so these regressions remain uncaught.

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!

@omarchybot

Copy link
Copy Markdown
Collaborator

The immediate-error backoff half is superseded by merged #7158. Suspending fingerprint scans while the display is blank remains unmerged, including the T1 backend case described here. Keeping this open for that remaining behavior; the retry implementation needs to be reconciled with the landed code.

GPT-6 in Codex and Claude Opus 5.5 Medium checked the coverage against the landed source; Claude's agreement does not guarantee independence. This closure review was read-only and did not rerun runtime tests.

@jandrusk

Copy link
Copy Markdown

Useful fix (and the hardware confirmation on MacBookPro14,x is helpful). Note #12420 is another open PR aimed at the same blanked-display fingerprint pause — worth comparing approaches and rebasing, since this branch currently conflicts with quattro.

Nobody can reach the sensor with the panel dark, yet the fingerprint PAM
stays armed and the retry timer re-arms it after every attempt for the
whole lock. Suspend the fingerprint when the lock blanks the display:
stop the retry and reach timers and drop an attempt already in flight
without counting it as a miss. Resume it on every route the panel comes
back by: runWake(), a screen set change, and a resume from sleep that
kept the same outputs and so never reached runWake(). The resume route
also re-arms the blank timer, so a dark wake blanks and suspends again.

The instant-failure backoff from the earlier revision is dropped; omacom#7158
landed its own.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@niconistal
niconistal force-pushed the lock-fingerprint-idle-when-blanked branch from 92b489b to 4b192ea Compare October 14, 2026 02:29
@niconistal

Copy link
Copy Markdown
Author

Thanks @jandrusk. Rebased onto quattro as one commit (4b192ea), conflict resolved.

The description has a side-by-side with #12420. In short: this PR also aborts a scan already running when the panel blanks. On resume it re-arms the reader and the blank timer without marking the display lit, so a resume with the panel still dark blanks again instead of scanning until the next input. I'm fine with either landing. If maintainers prefer #12420, I'll close this or fold the in-flight abort into it.

@omarchybot omarchybot added the bug Something isn't working label Oct 14, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed at 4b192ea by Claude Opus 5.5, with Codex Medium as the second opinion. Since this rebase, quattro has merged #15294 (7655773), which fixes the same bug. I recommend closing this pull request in its favour. That decision is the maintainer's.

What quattro now does. runBlank() calls pauseFingerprint(), which stops the retry timer, and startFingerprint() returns early while paused. No new fingerprint PAM session starts while the lock has the display blanked, on a healthy reader or on one failing instantly. The reader resumes on runWake(), when a display arrives (not when one is unplugged), and after a suspend the lock sees. Both halves of the problem in the description are covered: the ~31 s re-arm and the instant-failure loop on a wedged T1 backend.

What this branch still adds:

  • It aborts an attempt already in flight at blank time. Leave the fingerprint reader alone while the lock has the displays off #15294 lets that attempt finish on purpose, so a slow claim keeps its 20 s reach window. A wedged reader that fails instantly finishes at once either way.
  • On wake it starts the reader immediately. quattro keeps the remaining backoff and its tier, which gives a failing fprintd its idle window.
  • It resumes the reader on every screen change. quattro resumes only when an output arrives.

These differences are design choices the merged change made the other way, not defects it left open. The branch also conflicts with quattro in both files it touches, so it cannot merge as it stands.

What was checked. I read this branch against quattro at 84cfb93 and the #15294 diff. Codex Medium answered the same questions from the source and reached the same conclusion: no remaining defect fix, and the in-flight abort, immediate wake and every-screen-change resume are deliberate differences. It agreed with conclusions already written in this session, so its independence is not guaranteed. Nothing was run on a worker this round: verifying a fix that quattro already supersedes would spend a worker on nothing. The earlier worker reproduction in this thread was made against the previous head.

The T1 measurements on this pull request and in the comments (MacBookPro14,2 and 14,3) are still the best field evidence for the problem. A run of current quattro on one of those machines would confirm #15294 there. This waits on the maintainer.

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.

4 participants