mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-15 07:44:01 -04:00
* lock: keep the fingerprint reader usable across suspend The reader stopped responding after the lid was closed and opened, after a long idle period, and after suspend. The shell held a PAM session for as long as the screen was locked, so a suspend always landed on a running verify. fprintd then suspends the device under the verify, pam_fprintd's ReleaseDevice fails with "device is still busy", and the claim is never released, so every later Claim fails until fprintd restarts. The reader is now released when the monitors blank and armed again when they come back, so a suspend has nothing left to wedge. The PAM profile drops to max-tries=1 and sets an explicit timeout. pam_fprintd only counts a wrong finger, so one finished session is now one wrong scan and maxFprintTries means the number of scans it names rather than five times that. A timeout expiry arrives as PamResult.Error, exactly like a device fault, so a session that ran at least as long as the configured timeout is treated as a planned renewal instead of spending the error budget and painting an error. A suspend that still lands while the screen is on wedges as before. Recovery now waits out fprintd's idle timeout instead of climbing to it, which brings the reader back about 37 seconds after resume instead of about 98. SessionService gains lidOpened from UPower, because logind can ignore the lid on AC and resume alone is not enough. The lock PAM state machine is fixed alongside: PamResult.Failed was dropped, a pending retry outlived the contexts that owned it, and an availability check reset the wrong-scan counter. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q5LQHivuucTLXwLkvZMfcn * lock: time the fingerprint session from the verify, not the claim pam_fprintd's timeout runs from the verify, but the session age was measured from start(), which folds the claim into it. A slow claim plus a verify that failed before its own timeout could add up past the timeout and be taken for a planned renewal, skipping the backoff. A session that never reached a verify had the same problem. The age now starts at the message pam_fprintd sends when the verify begins, so a session that never verified can never qualify as an expiry, and a slow claim no longer ages a fault. The message is translated and quickshell clears it before completed, so only its timing is used, never its text. That message arrives after pam_fprintd has already armed its deadline, because VerifyStart is asynchronous, so the age read here runs short of the real timeout and a slack makes it up. The bias is deliberate. A fault misread as a timeout costs one extra retry, while a timeout misread as a fault parks the reader behind a backoff that grows to a minute, which on an idle lock screen would leave it unusable most of the time. Also corrects the comment that claimed a timeout is reported without a message. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q5LQHivuucTLXwLkvZMfcn --------- Co-authored-by: Claude Opus 5 <[email protected]>
87 lines
2.1 KiB
QML
87 lines
2.1 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import QtQuick
|
|
import Quickshell.Wayland
|
|
import qs.Common
|
|
|
|
FocusScope {
|
|
id: root
|
|
|
|
required property WlSessionLock lock
|
|
required property var pam
|
|
required property string sharedPasswordBuffer
|
|
required property string screenName
|
|
required property bool isLocked
|
|
|
|
signal passwordChanged(string newPassword)
|
|
signal unlockRequested
|
|
|
|
HoverHandler {
|
|
enabled: root.pam.awaitingActivityRetry
|
|
onPointChanged: root.pam.retryFprintOnActivity()
|
|
}
|
|
|
|
PointHandler {
|
|
onActiveChanged: {
|
|
if (active)
|
|
root.pam.retryFprintOnActivity();
|
|
}
|
|
}
|
|
|
|
Keys.onPressed: event => {
|
|
root.pam.retryFprintOnActivity();
|
|
if (videoScreensaver.active && videoScreensaver.inputEnabled) {
|
|
videoScreensaver.dismiss();
|
|
event.accepted = true;
|
|
}
|
|
}
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
color: "transparent"
|
|
}
|
|
|
|
LockScreenContent {
|
|
id: lockContent
|
|
|
|
anchors.fill: parent
|
|
demoMode: false
|
|
sessionLock: root.lock
|
|
pam: root.pam
|
|
passwordBuffer: root.sharedPasswordBuffer
|
|
screenName: root.screenName
|
|
enabled: !videoScreensaver.active
|
|
focus: !videoScreensaver.active
|
|
opacity: videoScreensaver.active ? 0 : 1
|
|
onUnlockRequested: root.unlockRequested()
|
|
onPasswordEdited: text => root.passwordChanged(text)
|
|
|
|
Behavior on opacity {
|
|
NumberAnimation {
|
|
duration: 200
|
|
}
|
|
}
|
|
}
|
|
|
|
VideoScreensaver {
|
|
id: videoScreensaver
|
|
anchors.fill: parent
|
|
screenName: root.screenName
|
|
onDismissed: Qt.callLater(() => lockContent.focusPasswordField())
|
|
}
|
|
|
|
Component.onCompleted: forceActiveFocus()
|
|
|
|
onIsLockedChanged: {
|
|
if (isLocked) {
|
|
forceActiveFocus();
|
|
lockContent.resetLockState();
|
|
if (SettingsData.lockScreenVideoEnabled) {
|
|
videoScreensaver.start();
|
|
}
|
|
return;
|
|
}
|
|
lockContent.unlocking = false;
|
|
}
|
|
}
|