From 72c9331c72f95ad56ae09ba4bf531f30d6ecd10f Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Tue, 19 May 2026 17:20:45 -0400 Subject: [PATCH] Make lock screen behave like a lock screen --- bin/omarchy-system-lock | 9 --------- shell/plugins/lock/LockView.qml | 20 ++++++++++++++------ shell/plugins/lock/Service.qml | 29 +++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 15 deletions(-) diff --git a/bin/omarchy-system-lock b/bin/omarchy-system-lock index f66dda24..1cc653d6 100755 --- a/bin/omarchy-system-lock +++ b/bin/omarchy-system-lock @@ -17,12 +17,3 @@ fi # Avoid running screensaver when locked pkill -f '[o]rg.omarchy.screensaver' - -if [[ ${OMARCHY_LOCK_ONLY:-false} != "true" ]]; then - ( - sleep 3 - [[ $(omarchy-shell lock isLocked 2>/dev/null) == "true" ]] || exit 0 - omarchy-brightness-keyboard off - omarchy-brightness-display off - ) & -fi diff --git a/shell/plugins/lock/LockView.qml b/shell/plugins/lock/LockView.qml index 54d14c84..34a6f719 100644 --- a/shell/plugins/lock/LockView.qml +++ b/shell/plugins/lock/LockView.qml @@ -24,6 +24,8 @@ Item { readonly property int fieldFontSize: Style.font.heading signal submitPassword(string password) + signal clearFailureRequested() + signal wakeRequested() function withAlpha(color, alpha) { return Qt.rgba(color.r, color.g, color.b, alpha) @@ -79,7 +81,9 @@ Item { MouseArea { anchors.fill: parent - onClicked: root.forcePasswordFocus() + hoverEnabled: true + onClicked: { root.wakeRequested(); root.forcePasswordFocus() } + onPositionChanged: root.wakeRequested() } Rectangle { @@ -115,8 +119,11 @@ Item { cursorVisible: activeFocus && !root.authenticatingPassword && root.hasTyped onTextChanged: { - if (text.length > 0) root.hasTyped = true - if (text.length > 0 && root.failureMessage.length > 0) root.failureMessage = "" + if (text.length > 0) { + root.hasTyped = true + root.wakeRequested() + } + if (text.length > 0 && root.failureMessage.length > 0) root.clearFailureRequested() } onAccepted: { @@ -127,6 +134,7 @@ Item { } Keys.onPressed: function(event) { + root.wakeRequested() if (event.key === Qt.Key_Escape || (event.modifiers & Qt.ControlModifier && event.key === Qt.Key_U)) { text = "" root.hasTyped = false @@ -137,12 +145,12 @@ Item { Text { anchors.fill: passwordInput - text: root.failureMessage.length > 0 ? root.failureMessage : root.placeholderText + text: root.authenticatingPassword ? "Checking…" : (root.failureMessage.length > 0 ? root.failureMessage : root.placeholderText) visible: passwordInput.text.length === 0 - color: root.failureMessage.length > 0 ? Color.lock.textError : Color.lock.text + color: (!root.authenticatingPassword && root.failureMessage.length > 0) ? Color.lock.textError : Color.lock.text font.family: "monospace" font.pixelSize: root.fieldFontSize - font.italic: root.failureMessage.length > 0 + font.italic: !root.authenticatingPassword && root.failureMessage.length > 0 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight diff --git a/shell/plugins/lock/Service.qml b/shell/plugins/lock/Service.qml index a0fc9b09..115099b4 100644 --- a/shell/plugins/lock/Service.qml +++ b/shell/plugins/lock/Service.qml @@ -57,6 +57,7 @@ Item { refreshFingerprintStatus() lockRequested = true sessionLock.locked = true + idleBlankTimer.restart() return true } @@ -65,18 +66,25 @@ Item { lockRequested = false resetAuthenticationState() + idleBlankTimer.stop() sessionLock.locked = false runWake() } function runWake() { if (!wakeProcess.running) wakeProcess.running = true + if (lockRequested) idleBlankTimer.restart() + } + + function runBlank() { + if (!blankProcess.running) blankProcess.running = true } function submitPassword(value) { var password = String(value || "") if (!lockRequested || authenticatingPassword || password.length === 0) return + runWake() pendingPassword = password failureMessage = "" authenticatingPassword = true @@ -101,6 +109,7 @@ Item { pendingPassword = "" failedAttempts += 1 failureMessage = "Authentication failed (" + failedAttempts + ")" + runWake() } function startFingerprint() { @@ -157,6 +166,8 @@ Item { inputEnabled: root.lockRequested scaleFactor: lockSurface.screen && lockSurface.screen.devicePixelRatio > 0 ? lockSurface.screen.devicePixelRatio : 1 onSubmitPassword: function(password) { root.submitPassword(password) } + onClearFailureRequested: root.failureMessage = "" + onWakeRequested: root.runWake() } } @@ -266,6 +277,24 @@ Item { command: ["bash", "-lc", "omarchy-system-wake"] } + Process { + id: blankProcess + command: ["bash", "-lc", "omarchy-brightness-keyboard off; omarchy-brightness-display off"] + } + + Timer { + id: idleBlankTimer + interval: 30000 + repeat: false + onTriggered: if (root.lockRequested && !root.authenticating) root.runBlank() + } + + onAuthenticatingChanged: { + if (!lockRequested) return + if (authenticating) idleBlankTimer.stop() + else idleBlankTimer.restart() + } + FileView { path: "/etc/pam.d/omarchy-lock-password" watchChanges: true