diff --git a/dots/.config/quickshell/ii/modules/lock/Lock.qml b/dots/.config/quickshell/ii/modules/lock/Lock.qml index 5cfc12d72..12ba1a2eb 100644 --- a/dots/.config/quickshell/ii/modules/lock/Lock.qml +++ b/dots/.config/quickshell/ii/modules/lock/Lock.qml @@ -25,13 +25,6 @@ Scope { LockContext { id: lockContext - Connections { - target: GlobalStates - function onScreenLockedChanged() { - if (GlobalStates.screenLocked) lockContext.reset(); - } - } - Connections { target: GlobalStates function onScreenLockedChanged() { diff --git a/dots/.config/quickshell/ii/modules/lock/LockContext.qml b/dots/.config/quickshell/ii/modules/lock/LockContext.qml index 8a1bd5854..8b245237b 100644 --- a/dots/.config/quickshell/ii/modules/lock/LockContext.qml +++ b/dots/.config/quickshell/ii/modules/lock/LockContext.qml @@ -2,7 +2,7 @@ import qs import qs.modules.common import QtQuick import Quickshell -import Quickshell.Io +import Quickshell.Io // Required for StdioCollector import Quickshell.Services.Pam Scope { @@ -43,46 +43,6 @@ Scope { root.clearText(); root.unlockInProgress = false; } - - function tryFingerUnlock() { - fingerPam.start(); - } - - function stopPam() { - fingerPam.abort(); - } - - Process { - id: fingerprintCheckProcess - command: ["bash", "-c", "fprintd-list $(whoami)"] - stdout: StdioCollector { - id: fingerprintOutputCollector - onStreamFinished: { - root.fingerprintsConfigured = fingerprintOutputCollector.text.includes("Fingerprints for user"); - } - } - onExited: (exitCode, exitStatus) => { - if (exitCode !== 0) { - console.warn("fprintd-list command exited with error:", exitCode, exitStatus); - root.fingerprintsConfigured = false; - } - } - } - - PamContext { - id: fingerPam - - configDirectory: "pam" - config: "fprintd.conf" - - onCompleted: result => { - if (result == PamResult.Success) { - root.unlocked(root.targetAction); - } else if (result == PamResult.Error){ // if timeout or etc.. - tryFingerUnlock() - } - } - } Timer { id: passwordClearTimer @@ -106,6 +66,33 @@ Scope { pam.start(); } + function tryFingerUnlock() { + if (root.fingerprintsConfigured) { + fingerPam.start(); + } + } + + function stopFingerPam() { + fingerPam.abort(); + } + + Process { + id: fingerprintCheckProcess + command: ["bash", "-c", "fprintd-list $(whoami)"] + stdout: StdioCollector { + id: fingerprintOutputCollector + onStreamFinished: { + root.fingerprintsConfigured = fingerprintOutputCollector.text.includes("Fingerprints for user"); + } + } + onExited: (exitCode, exitStatus) => { + if (exitCode !== 0) { + console.warn("fprintd-list command exited with error:", exitCode, exitStatus); + root.fingerprintsConfigured = false; + } + } + } + PamContext { id: pam @@ -120,6 +107,7 @@ Scope { onCompleted: result => { if (result == PamResult.Success) { root.unlocked(root.targetAction); + stopFingerPam(); } else { root.clearText(); root.unlockInProgress = false; @@ -129,4 +117,19 @@ Scope { } } + PamContext { + id: fingerPam + + configDirectory: "pam" + config: "fprintd.conf" + + onCompleted: result => { + if (result == PamResult.Success) { + root.unlocked(root.targetAction); + stopFingerPam(); + } else if (result == PamResult.Error){ // if timeout or etc.. + tryFingerUnlock() + } + } + } }