re-acquire session lock on startup if logind reports session locked

This commit is contained in:
Damocles 2026-04-18 09:33:48 +02:00
parent 3c9bf06bf7
commit f071bb17e1

View file

@ -40,8 +40,10 @@ Scope {
} }
onExited: { onExited: {
if (root._sessionPath) if (root._sessionPath) {
_logindMonitor.running = true; _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 // Set logind LockedHint when lock state changes
Process { Process {
id: _lockedHint id: _lockedHint