Refine Plasma lock screen authentication retries

This commit is contained in:
ajp_anton
2026-09-04 14:58:34 +00:00
parent 088c42bc14
commit 810c8caf74
5 changed files with 325 additions and 45 deletions
+55 -41
View File
@@ -1,6 +1,6 @@
--- a/contents/lockscreen/LockScreenUi.qml
+++ b/contents/lockscreen/LockScreenUi.qml
@@ -83,6 +83,15 @@
@@ -83,20 +83,32 @@
}
}
@@ -16,7 +16,24 @@
SessionManagement {
id: sessionManagement
}
@@ -108,7 +117,6 @@
KeyboardIndicator.KeyState {
id: capsLockState
key: Qt.Key_CapsLock
}
Connections {
target: sessionManagement
function onAboutToSuspend() {
root.clearPassword();
}
+ function onResumingFromSuspend() {
+ resumeAuthenticationTimer.restart();
+ }
}
RejectPasswordAnimation {
@@ -108,7 +120,6 @@
id: lockScreenRoot
property bool uiVisible: false
@@ -24,8 +41,12 @@
property bool blockUI: containsMouse && (mainStack.depth > 1 || mainBlock.mainPasswordBox.text.length > 0 || inputPanel.keyboardActive)
x: parent.x
@@ -119,10 +127,7 @@
cursorShape: uiVisible ? Qt.ArrowCursor : Qt.BlankCursor
@@ -118,13 +129,10 @@
width: parent.width
height: parent.height
hoverEnabled: true
- cursorShape: uiVisible ? Qt.ArrowCursor : Qt.BlankCursor
+ cursorShape: Qt.ArrowCursor
drag.filterChildren: true
onPressed: uiVisible = true;
- onPositionChanged: {
@@ -36,49 +57,42 @@
onUiVisibleChanged: {
if (uiVisible) {
Window.window.requestActivate();
@@ -135,6 +140,13 @@
@@ -135,6 +143,18 @@
}
authenticator.startAuthenticating();
}
+ Timer {
+ // Keep the authentication backend active while the prompt is visible.
+ interval: 1000
+ running: parent.uiVisible
+ repeat: true
+ id: resumeAuthenticationTimer
+ interval: 1500
+ onTriggered: authenticator.startAuthenticating()
+ }
+ Timer {
+ id: postGraceAuthenticationTimer
+ // Retry once after Plasma's default five-second lock grace period.
+ interval: 6000
+ running: root.viewVisible
+ onTriggered: authenticator.startAuthenticating()
+ }
onBlockUIChanged: {
if (blockUI) {
fadeoutTimer.running = false;
@@ -143,19 +155,12 @@
fadeoutTimer.restart();
}
}
- onExited: {
- uiVisible = false;
- }
Keys.onEscapePressed: {
- // If the escape key is pressed, kscreenlocker will turn off the screen.
- // We do not want to show the password prompt in this case.
- if (uiVisible) {
- uiVisible = false;
- if (inputPanel.keyboardActive) {
- inputPanel.showHide();
- }
- root.clearPassword();
+ // KScreenLocker will turn off the screen; leave the prompt ready for wake-up.
+ if (inputPanel.keyboardActive) {
+ inputPanel.showHide();
}
+ root.clearPassword();
}
Keys.onPressed: event => {
uiVisible = true;
@@ -167,7 +172,6 @@
onTriggered: {
if (!lockScreenRoot.blockUI) {
mainBlock.mainPasswordBox.showPassword = false;
- lockScreenRoot.uiVisible = false;
}
}
}
@@ -194,6 +214,6 @@
WallpaperFader {
anchors.fill: parent
- state: lockScreenRoot.uiVisible ? "on" : "off"
+ state: "on"
source: wallpaper
mainStack: mainStack
footer: footer
@@ -211,7 +231,7 @@
samples: 15
spread: 0.2
color : Qt.rgba(0, 0, 0, 0.7)
- opacity: lockScreenRoot.uiVisible ? 0 : 1
+ opacity: 0
Behavior on opacity {
OpacityAnimator {
duration: Kirigami.Units.veryLongDuration * 2
@@ -265 +285 @@
- lockScreenUiVisible: lockScreenRoot.uiVisible
+ lockScreenUiVisible: true