forked from Shinonome/dots-hyprland
🐛 fix(lock): remove duplicate connection, only start if configured, stop on unlock
This commit is contained in:
@@ -25,13 +25,6 @@ Scope {
|
|||||||
LockContext {
|
LockContext {
|
||||||
id: lockContext
|
id: lockContext
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: GlobalStates
|
|
||||||
function onScreenLockedChanged() {
|
|
||||||
if (GlobalStates.screenLocked) lockContext.reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: GlobalStates
|
target: GlobalStates
|
||||||
function onScreenLockedChanged() {
|
function onScreenLockedChanged() {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import qs
|
|||||||
import qs.modules.common
|
import qs.modules.common
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io // Required for StdioCollector
|
||||||
import Quickshell.Services.Pam
|
import Quickshell.Services.Pam
|
||||||
|
|
||||||
Scope {
|
Scope {
|
||||||
@@ -44,46 +44,6 @@ Scope {
|
|||||||
root.unlockInProgress = false;
|
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 {
|
Timer {
|
||||||
id: passwordClearTimer
|
id: passwordClearTimer
|
||||||
interval: 10000
|
interval: 10000
|
||||||
@@ -106,6 +66,33 @@ Scope {
|
|||||||
pam.start();
|
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 {
|
PamContext {
|
||||||
id: pam
|
id: pam
|
||||||
|
|
||||||
@@ -120,6 +107,7 @@ Scope {
|
|||||||
onCompleted: result => {
|
onCompleted: result => {
|
||||||
if (result == PamResult.Success) {
|
if (result == PamResult.Success) {
|
||||||
root.unlocked(root.targetAction);
|
root.unlocked(root.targetAction);
|
||||||
|
stopFingerPam();
|
||||||
} else {
|
} else {
|
||||||
root.clearText();
|
root.clearText();
|
||||||
root.unlockInProgress = false;
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user