From c86dbeb2b337e8b43995ba314531a1d45b13b2fb Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sat, 6 Sep 2025 08:44:25 +0200 Subject: [PATCH] lock: key presses also reset inactivity timer --- .../ii/modules/lock/LockContext.qml | 4 ++ .../ii/modules/lock/LockSurface.qml | 37 +++++++++++-------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/.config/quickshell/ii/modules/lock/LockContext.qml b/.config/quickshell/ii/modules/lock/LockContext.qml index 1aeefdc5a..976aa9c6a 100644 --- a/.config/quickshell/ii/modules/lock/LockContext.qml +++ b/.config/quickshell/ii/modules/lock/LockContext.qml @@ -15,6 +15,10 @@ Scope { property bool unlockInProgress: false property bool showFailure: false + function resetClearTimer() { + passwordClearTimer.restart(); + } + Timer { id: passwordClearTimer interval: 10000 diff --git a/.config/quickshell/ii/modules/lock/LockSurface.qml b/.config/quickshell/ii/modules/lock/LockSurface.qml index b623b9860..db9e0d3d1 100644 --- a/.config/quickshell/ii/modules/lock/LockSurface.qml +++ b/.config/quickshell/ii/modules/lock/LockSurface.qml @@ -14,17 +14,26 @@ MouseArea { property bool active: false property bool showInputField: active || context.currentText.length > 0 + // Force focus on entry function forceFieldFocus() { passwordBox.forceActiveFocus(); } - Connections { target: context function onShouldReFocus() { forceFieldFocus(); } } + hoverEnabled: true + acceptedButtons: Qt.LeftButton + onPressed: mouse => { + forceFieldFocus(); + } + onPositionChanged: mouse => { + forceFieldFocus(); + } + // Toolbar appearing animation property real toolbarScale: 0.9 property real toolbarOpacity: 0 Behavior on toolbarScale { @@ -38,30 +47,22 @@ MouseArea { animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this) } + // Init Component.onCompleted: { forceFieldFocus(); toolbarScale = 1; toolbarOpacity = 1; } - Keys.onPressed: event => { // Esc to clear - if (event.key === Qt.Key_Escape) { + // Key presses + Keys.onPressed: event => { + root.context.resetClearTimer(); + if (event.key === Qt.Key_Escape) { // Esc to clear root.context.currentText = ""; } forceFieldFocus(); } - hoverEnabled: true - acceptedButtons: Qt.LeftButton - onPressed: mouse => { - forceFieldFocus(); - } - onPositionChanged: mouse => { - forceFieldFocus(); - } - - anchors.fill: parent - // RippleButton { // anchors { // top: parent.top @@ -77,7 +78,7 @@ MouseArea { // } // } - // Controls + // Main toolbar: password box Toolbar { id: mainIsland anchors { @@ -114,6 +115,10 @@ MouseArea { passwordBox.text = root.context.currentText; } } + + Keys.onPressed: event => { + root.context.resetClearTimer(); + } } ToolbarButton { @@ -136,6 +141,7 @@ MouseArea { } } + // Left toolbar Toolbar { id: leftIsland anchors { @@ -207,6 +213,7 @@ MouseArea { } } + // Right toolbar Toolbar { id: rightIsland anchors {