Keep fingerprint unlock offered on the lock screen with the lid shut
The reader is still reachable on an external keyboard or a docked laptop, so hiding the icon and skipping the scan just forced the password. sudo and polkit keep their pam_exec lid gates. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
1bc98a7dd5
commit
b65dde39fc
@@ -22,9 +22,6 @@ Item {
|
|||||||
property bool fingerprintAuthenticating: false
|
property bool fingerprintAuthenticating: false
|
||||||
property bool passwordPamConfigured: false
|
property bool passwordPamConfigured: false
|
||||||
property bool fingerprintConfigured: false
|
property bool fingerprintConfigured: false
|
||||||
// Lid shut → the reader is unreachable, so hide the affordance and don't
|
|
||||||
// bother scanning; fall back to the password like the polkit dialog does.
|
|
||||||
property bool laptopClosed: false
|
|
||||||
property bool previewVisible: false
|
property bool previewVisible: false
|
||||||
property string enteredPassword: ""
|
property string enteredPassword: ""
|
||||||
property string pendingPassword: ""
|
property string pendingPassword: ""
|
||||||
@@ -37,8 +34,6 @@ Item {
|
|||||||
|
|
||||||
readonly property bool locked: lockRequested || sessionLock.locked || sessionLock.secure
|
readonly property bool locked: lockRequested || sessionLock.locked || sessionLock.secure
|
||||||
readonly property bool authenticating: authenticatingPassword || fingerprintAuthenticating
|
readonly property bool authenticating: authenticatingPassword || fingerprintAuthenticating
|
||||||
// Fingerprint is only offered when a sensor is enrolled and the lid is open.
|
|
||||||
readonly property bool fingerprintAvailable: fingerprintConfigured && !laptopClosed
|
|
||||||
|
|
||||||
function realScreenCount() {
|
function realScreenCount() {
|
||||||
var screens = Quickshell.screens || []
|
var screens = Quickshell.screens || []
|
||||||
@@ -87,10 +82,6 @@ Item {
|
|||||||
if (!fingerprintCheckProc.running) fingerprintCheckProc.running = true
|
if (!fingerprintCheckProc.running) fingerprintCheckProc.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshLaptopClosed() {
|
|
||||||
if (!laptopClosedProc.running) laptopClosedProc.running = true
|
|
||||||
}
|
|
||||||
|
|
||||||
function logEvent(event) {
|
function logEvent(event) {
|
||||||
lastEvent = event
|
lastEvent = event
|
||||||
lastEventAt = new Date().toISOString()
|
lastEventAt = new Date().toISOString()
|
||||||
@@ -124,7 +115,6 @@ Item {
|
|||||||
Qt.callLater(function() {
|
Qt.callLater(function() {
|
||||||
root.refreshBackground()
|
root.refreshBackground()
|
||||||
root.refreshFingerprintStatus()
|
root.refreshFingerprintStatus()
|
||||||
root.refreshLaptopClosed()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@@ -192,7 +182,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function startFingerprint() {
|
function startFingerprint() {
|
||||||
if (!lockRequested || !sessionLock.secure || !fingerprintAvailable) return
|
if (!lockRequested || !sessionLock.secure || !fingerprintConfigured) return
|
||||||
if (fingerprintPam.active || fingerprintAuthenticating) return
|
if (fingerprintPam.active || fingerprintAuthenticating) return
|
||||||
|
|
||||||
fingerprintAuthenticating = true
|
fingerprintAuthenticating = true
|
||||||
@@ -207,7 +197,7 @@ Item {
|
|||||||
if (!lockRequested) return
|
if (!lockRequested) return
|
||||||
if (result === PamResult.Success) {
|
if (result === PamResult.Success) {
|
||||||
finishUnlock()
|
finishUnlock()
|
||||||
} else if (fingerprintAvailable) {
|
} else if (fingerprintConfigured) {
|
||||||
fingerprintRetryTimer.restart()
|
fingerprintRetryTimer.restart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -255,7 +245,7 @@ Item {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
backgroundPath: root.backgroundPath
|
backgroundPath: root.backgroundPath
|
||||||
backgroundVersion: root.backgroundVersion
|
backgroundVersion: root.backgroundVersion
|
||||||
fingerprintConfigured: root.fingerprintAvailable
|
fingerprintConfigured: root.fingerprintConfigured
|
||||||
authenticatingPassword: root.authenticatingPassword
|
authenticatingPassword: root.authenticatingPassword
|
||||||
failureMessage: root.failureMessage
|
failureMessage: root.failureMessage
|
||||||
failedAttempts: root.failedAttempts
|
failedAttempts: root.failedAttempts
|
||||||
@@ -285,7 +275,7 @@ Item {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
backgroundPath: root.backgroundPath
|
backgroundPath: root.backgroundPath
|
||||||
backgroundVersion: root.backgroundVersion
|
backgroundVersion: root.backgroundVersion
|
||||||
fingerprintConfigured: root.fingerprintAvailable
|
fingerprintConfigured: root.fingerprintConfigured
|
||||||
authenticatingPassword: false
|
authenticatingPassword: false
|
||||||
failureMessage: ""
|
failureMessage: ""
|
||||||
failedAttempts: 0
|
failedAttempts: 0
|
||||||
@@ -334,7 +324,7 @@ Item {
|
|||||||
|
|
||||||
onError: function(error) {
|
onError: function(error) {
|
||||||
root.fingerprintAuthenticating = false
|
root.fingerprintAuthenticating = false
|
||||||
if (root.lockRequested && root.fingerprintAvailable) fingerprintRetryTimer.restart()
|
if (root.lockRequested && root.fingerprintConfigured) fingerprintRetryTimer.restart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,19 +356,8 @@ Item {
|
|||||||
stdout: StdioCollector { id: fingerprintCheckStdout; waitForEnd: true }
|
stdout: StdioCollector { id: fingerprintCheckStdout; waitForEnd: true }
|
||||||
onExited: {
|
onExited: {
|
||||||
root.fingerprintConfigured = String(fingerprintCheckStdout.text || "").trim() === "yes"
|
root.fingerprintConfigured = String(fingerprintCheckStdout.text || "").trim() === "yes"
|
||||||
if (root.lockRequested && root.fingerprintAvailable) root.startFingerprint()
|
if (root.lockRequested && root.fingerprintConfigured) root.startFingerprint()
|
||||||
else if (!root.fingerprintAvailable && fingerprintPam.active) fingerprintPam.abort()
|
else if (!root.fingerprintConfigured && fingerprintPam.active) fingerprintPam.abort()
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: laptopClosedProc
|
|
||||||
command: ["bash", "-c", "omarchy-hw-laptop-closed && echo closed || echo open"]
|
|
||||||
stdout: StdioCollector { id: laptopClosedStdout; waitForEnd: true }
|
|
||||||
onExited: {
|
|
||||||
root.laptopClosed = String(laptopClosedStdout.text || "").trim() === "closed"
|
|
||||||
if (root.lockRequested && root.fingerprintAvailable) root.startFingerprint()
|
|
||||||
else if (!root.fingerprintAvailable && fingerprintPam.active) fingerprintPam.abort()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -446,7 +425,6 @@ Item {
|
|||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
refreshBackground()
|
refreshBackground()
|
||||||
refreshFingerprintStatus()
|
refreshFingerprintStatus()
|
||||||
refreshLaptopClosed()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
@@ -472,7 +450,6 @@ Item {
|
|||||||
realScreens: root.realScreenCount(),
|
realScreens: root.realScreenCount(),
|
||||||
passwordPam: root.passwordPamConfigured,
|
passwordPam: root.passwordPamConfigured,
|
||||||
fingerprint: root.fingerprintConfigured,
|
fingerprint: root.fingerprintConfigured,
|
||||||
laptopClosed: root.laptopClosed,
|
|
||||||
authenticating: root.authenticating,
|
authenticating: root.authenticating,
|
||||||
lastEvent: root.lastEvent,
|
lastEvent: root.lastEvent,
|
||||||
lastEventAt: root.lastEventAt
|
lastEventAt: root.lastEventAt
|
||||||
|
|||||||
Reference in New Issue
Block a user