From f071bb17e1cf0589bce3d1a2e9d91703ee2f8cc7 Mon Sep 17 00:00:00 2001 From: Damocles Date: Sat, 18 Apr 2026 09:33:48 +0200 Subject: [PATCH] re-acquire session lock on startup if logind reports session locked --- shell/lock/Lock.qml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/shell/lock/Lock.qml b/shell/lock/Lock.qml index 95a9afa..e139e16 100644 --- a/shell/lock/Lock.qml +++ b/shell/lock/Lock.qml @@ -40,8 +40,10 @@ Scope { } onExited: { - if (root._sessionPath) + if (root._sessionPath) { _logindMonitor.running = true; + _lockStateCheck.running = true; + } } } @@ -62,6 +64,21 @@ Scope { } } + // Check if session is already locked on startup (crash recovery) + Process { + id: _lockStateCheck + running: false + command: ["busctl", "get-property", "--system", "org.freedesktop.login1", root._sessionPath, "org.freedesktop.login1.Session", "LockedHint"] + + stdout: SplitParser { + onRead: data => { + // Output: b true/false + if (data.indexOf("true") !== -1 && root._enabled && !_lock.locked) + _lock.locked = true; + } + } + } + // Set logind LockedHint when lock state changes Process { id: _lockedHint