From 7eb689c621f3015387952f4310ce728f2d89f5b1 Mon Sep 17 00:00:00 2001 From: wxlyyy <1556588440@qq.com> Date: Fri, 23 Jan 2026 00:20:37 +0800 Subject: [PATCH] LockScreen: fingerprint auth without key or button --- Commons/Settings.qml | 4 ++-- Modules/LockScreen/LockContext.qml | 11 +++++------ Modules/LockScreen/LockScreen.qml | 2 +- Modules/LockScreen/LockScreenPanel.qml | 8 ++++++-- nix/package.nix | 2 -- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 8d76a57be..7ec6ea1bf 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -1115,8 +1115,8 @@ Singleton { Quickshell.execDetached(["mkdir", "-p", pamConfigDir]); // Generate the PAM config file content - var configContent = "#auth sufficient pam_fprintd.so max-tries=1\n"; - configContent += "# only uncomment this if you have a fingerprint reader\n"; + var configContent = "auth sufficient pam_fprintd.so timeout=-1\n"; + configContent += "auth sufficient /run/current-system/sw/lib/security/pam_fprintd.so timeout=-1 # for NixOS\n"; configContent += "auth required pam_unix.so\n"; // Write the config file using heredoc to avoid escaping issues diff --git a/Modules/LockScreen/LockContext.qml b/Modules/LockScreen/LockContext.qml index 0eefbdc63..e9920872f 100644 --- a/Modules/LockScreen/LockContext.qml +++ b/Modules/LockScreen/LockContext.qml @@ -36,9 +36,13 @@ Scope { infoMessage = ""; showFailure = false; errorMessage = ""; + if (!waitingForPassword) { + pam.abort(); + } occupyFingerprintSensorProc.running = true; } else { occupyFingerprintSensorProc.running = false; + pam.start(); } } @@ -51,17 +55,12 @@ Scope { if (waitingForPassword) { pam.respond(currentText); + unlockInProgress = true; waitingForPassword = false; showInfo = false; return; } - if (root.unlockInProgress) { - Logger.i("LockContext", "Unlock already in progress, ignoring duplicate attempt"); - return; - } - - root.unlockInProgress = true; errorMessage = ""; showFailure = false; diff --git a/Modules/LockScreen/LockScreen.qml b/Modules/LockScreen/LockScreen.qml index 99807180a..f5d8f1e5f 100644 --- a/Modules/LockScreen/LockScreen.qml +++ b/Modules/LockScreen/LockScreen.qml @@ -267,7 +267,7 @@ Loader { width: 0 height: 0 visible: false - enabled: !lockContext.unlockInProgress || lockContext.waitingForPassword + enabled: !lockContext.unlockInProgress font.pointSize: Style.fontSizeM color: Color.mPrimary echoMode: TextInput.Password diff --git a/Modules/LockScreen/LockScreenPanel.qml b/Modules/LockScreen/LockScreenPanel.qml index 2288dd643..e0034df24 100644 --- a/Modules/LockScreen/LockScreenPanel.qml +++ b/Modules/LockScreen/LockScreenPanel.qml @@ -20,6 +20,10 @@ Item { required property var keyboardLayout required property TextInput passwordInput + Component.onCompleted: { + doUnlock(); + } + function doUnlock() { if (lockControl) { lockControl.tryUnlock(); @@ -620,7 +624,7 @@ Item { radius: Math.min(Style.iRadiusL, width / 2) color: eyeButtonArea.containsMouse ? Color.mPrimary : "transparent" visible: passwordInput.text.length > 0 - enabled: !lockContext || !lockContext.unlockInProgress || lockContext.waitingForPassword + enabled: !lockContext || !lockContext.unlockInProgress NIcon { anchors.centerIn: parent @@ -664,7 +668,7 @@ Item { color: submitButtonArea.containsMouse ? Color.mPrimary : "transparent" border.color: Color.mPrimary border.width: Style.borderS - enabled: !lockControl || !lockControl.unlockInProgress || lockControl.waitingForPassword + enabled: !lockContext || !lockContext.unlockInProgress NIcon { anchors.centerIn: parent diff --git a/nix/package.nix b/nix/package.nix index 140593664..e7cc0dcc8 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -1,6 +1,5 @@ { version ? "dirty", - pamConfig ? "login", extraPackages ? [ ], runtimeDeps ? [ brightnessctl @@ -90,7 +89,6 @@ stdenvNoCC.mkDerivation { preFixup = '' qtWrapperArgs+=( - --set NOCTALIA_PAM_CONFIG ${pamConfig} --prefix PATH : ${lib.makeBinPath (runtimeDeps ++ extraPackages)} --add-flags "-p $out/share/noctalia-shell" ${lib.optionalString calendarSupport "--prefix GI_TYPELIB_PATH : ${giTypelibPath}"}