Skip to content

Leave the fingerprint reader alone while the lock has the displays off - #15294

Merged
dhh merged 6 commits into
quattrofrom
lock-fingerprint-pause-blank
Oct 14, 2026
Merged

dhh merged 6 commits into
quattrofrom
lock-fingerprint-pause-blank

Conversation

@dhh

@dhh dhh commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What changed

The lock kept a fingerprint verify running for the whole time the session was locked: each pam_fprintd attempt waits for a finger until its own timeout, then the lock started the next one 250ms later. A 1-second timer also ran throughout to notice sleep. That kept the reader and fprintd awake all night, even with the displays off.

Now, once the lock blanks the displays (runBlank), it holds back the next attempt:

  • An attempt already running finishes under its own timeouts (a slow claim still gets its 20s reach window), with the sleep watch covering it; after that nothing runs.
  • A wake (runWake: a key, the touchpad, a password attempt) or a display arriving re-arms the retry with whatever backoff was set, so a failing reader keeps the idle window that lets a wedged fprintd exit.
  • After a lock request while blank (omarchy-system-sleep-lock makes one before every suspend), a 1s timer watches for at most 15 ticks for the wall-clock jump a suspend leaves. If it sees one, the reader comes back with the resume grace, and the blank countdown pauses it again if nothing happens. The idle service's repeat lock request lapses with the reader still paused.
  • Unplugging a monitor while blank doesn't wake the reader; only an output arriving does.

Trade-off: while the display is off, a finger alone no longer unlocks; wake the screen first. In the first few seconds after locking, after waking it, or after a resume, a finger works as before. The manual's fingerprint section says so.

Known gap: a display woken by something the lock never sees (a locked = true volume or brightness bind) keeps the reader paused until a key or pointer move reaches the lock.

Tests

  • lock-fingerprint-service-test.sh drives the real Service.qml: a claim in progress survives the blank; nothing runs after it; a wake re-arms; a capped backoff and the miss streak survive pause and wake; a repeated lock with no sleep leaves the reader paused; a seen sleep resumes it with the grace; unlock reset clears everything. Each check was mutation-checked.
  • lock-blank-fingerprint-test.sh checks that runBlank pauses, runWake resumes, the pre-suspend lock request starts the sleep watch, and only an arriving display resumes (those paths drive the real displays, so the fixture can't call them).
  • lock-fingerprint-retry, lock-fingerprint-indicator and lock-stranded-recovery pass.

Merge after #15289; both change runBlank/runWake, and this rebases on top.

Human check

On a laptop with a fingerprint enrolled: lock, wait for the blank, press a key, unlock with a finger. Lock and unlock with a finger right away. Lock, let it blank, suspend, resume without touching anything, and unlock with a finger.

🤖 Generated with Claude Code

The lock kept a fingerprint verify running for the whole lock, starting a new
one a quarter-second after each ended, plus a 1-second timer to notice
sleep. That held the reader and fprintd awake all night. Blanking the
displays now closes the attempt without counting it as a miss, stops the
retry and sleep-watch timers, and any wake starts the reader again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium impact] Changes fingerprint reader behavior during lock screen blanking.

Fix the wake path's shortened idle wait before merging.

Findings

  1. P1 Waking interrupts reader recovery ▶

Summary

The PR pauses new fingerprint attempts while the lock has the displays off.

  • The fingerprint reader rests while the lock display is blank.
  • A detected suspend restarts fingerprint checks on a blank lock.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Displays blank] --> B[Pause new attempts]
  B --> C{What happens next?}
  C -->|Key or pointer input| D[Restore remaining wait]
  D --> E[Try to shorten wait]
  E --> F[Remaining interval bypasses capped idle guard]
  C -->|Repeated lock request| G[Watch for a clock gap]
  G -->|No gap after 20 ticks| B
  G -->|Sleep seen| H[Resume with grace]
  H --> I[Restart blank countdown]
Loading

Reviews (4) · Last reviewed commit: "Count time spent blank toward the finger..." · Reviewed by Greptile

Comment thread shell/plugins/lock/Service.qml Resolved
Comment thread shell/plugins/lock/Service.qml Resolved
dhh and others added 2 commits October 13, 2026 14:58
…ep its backoff

Aborting the attempt at the blank cut short a slow reader's claim, and
starting one straight away on wake skipped the backoff that gives a wedged
fprintd its idle exit. Blanking now only holds back the next attempt: one in
flight finishes under its own timeouts with the sleep watch covering it, a
wake re-arms the retry with whatever backoff was set, and the lock request
made before every suspend marks a sleep so the wake recovers at once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lay arriving

A resume can light the panel with no input, which left the reader paused
under a visible lock. The lock request made before every suspend now arms a
one-shot that fires once the machine runs again, resuming the reader and
restarting the blank countdown. A screen change resumes it only when an
output arrives, so unplugging a monitor while blank keeps it paused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment thread shell/plugins/lock/Service.qml Resolved
dhh and others added 2 commits October 13, 2026 15:14
The idle service repeats the lock request while already locked, and that was
taken for a suspend, waking the reader under a blank display. After a lock
request the lock now watches the wall clock for the few seconds a suspend
takes to begin, and resumes the reader only on the jump a sleep leaves.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ogind's delay

A wake restarted the full backoff, so a reader whose wait ran out while blank
could be paused again by the next blank before any attempt. The retry now
resumes with whatever is left of its deadline. The sleep watch after a lock
request runs 20 seconds, past logind's 15-second inhibitor delay, so a
suspend that waits on another inhibitor is still seen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
noteFingerprintResumed()
fingerprintRetryTimer.interval = FingerprintModel.MATCH_RETRY_MS
} else {
fingerprintRetryTimer.interval = Math.max(FingerprintModel.MATCH_RETRY_MS, fingerprintRetryDueMs - Date.now())

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 Waking interrupts reader recovery

When the user wakes the screen during a capped 40-second retry, resumeFingerprint() replaces the interval with the remaining wait. That value is below ERROR_RETRY_CAP_MS, so the following nudgeFingerprint() skips the 32-second idle guard and starts another attempt after 250ms. A wedged fprintd can lose the quiet time it needs to exit and recover.

Keep the backoff tier separate from the remaining timer interval, and use that tier for the idle guard.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 87e9c0c: the armed retry's backoff is now kept in its own fingerprintRetryBackoffMs, and the input guard reads that instead of the timer interval, so a wake that shortens the timer to the remaining wait still leaves a capped retry's 32s idle window intact. New check in the service fixture (wake mid-cap, then input) fails with the old guard.

@dhh
dhh merged commit 7655773 into quattro Oct 14, 2026
@dhh
dhh deleted the lock-fingerprint-pause-blank branch October 14, 2026 07:44
@emirb emirb added this to the 4.5 milestone Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants