From 31cc51b6e97b70002c1a6cff0cce6739d5a9cfeb Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sun, 10 Aug 2025 19:37:34 +1000 Subject: lock: add placeholder + manual focus --- modules/lock/Pam.qml | 48 +++++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 17 deletions(-) (limited to 'modules/lock/Pam.qml') diff --git a/modules/lock/Pam.qml b/modules/lock/Pam.qml index 44e8671..7863603 100644 --- a/modules/lock/Pam.qml +++ b/modules/lock/Pam.qml @@ -1,8 +1,9 @@ +import Quickshell import Quickshell.Wayland import Quickshell.Services.Pam import QtQuick -PamContext { +Scope { id: root required property WlSessionLock lock @@ -11,11 +12,11 @@ PamContext { property string buffer: "" function handleKey(event: KeyEvent): void { - if (active) + if (passwd.active) return; if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) { - start(); + passwd.start(); } else if (event.key === Qt.Key_Backspace) { if (event.modifiers & Qt.ControlModifier) { buffer = ""; @@ -28,23 +29,36 @@ PamContext { } } - onResponseRequiredChanged: { - if (!responseRequired) - return; + PamContext { + id: passwd + + onResponseRequiredChanged: { + if (!responseRequired) + return; + + respond(root.buffer); + root.buffer = ""; + } - respond(buffer); - buffer = ""; + onCompleted: res => { + if (res === PamResult.Success) + return root.lock.unlock(); + + if (res === PamResult.Error) + root.state = "error"; + else if (res === PamResult.MaxTries) + root.state = "max"; + else if (res === PamResult.Failed) + root.state = "fail"; + + stateReset.restart(); + } } - onCompleted: res => { - if (res === PamResult.Success) - return lock.unlock(); + Timer { + id: stateReset - if (res === PamResult.Error) - state = "error"; - else if (res === PamResult.MaxTries) - state = "max"; - else if (res === PamResult.Failed) - state = "fail"; + interval: 4000 + onTriggered: root.state = "none" } } -- cgit v1.2.3-freya