1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00

Check lock status on startup

This commit is contained in:
bbedward
2025-08-12 10:54:39 -04:00
parent 5c3d79eef7
commit 4bf4dc20cc

View File

@@ -13,6 +13,35 @@ Item {
loader.activeAsync = true
}
function checkLockedOnStartup() {
lockStateChecker.running = true
}
Component.onCompleted: {
checkLockedOnStartup()
}
Process {
id: lockStateChecker
command: ["sh", "-c", "loginctl show-session $(loginctl list-sessions --no-legend | awk '{print $1}' | head -1) --property=LockedHint"]
running: false
onExited: (exitCode, exitStatus) => {
if (exitCode !== 0) {
console.warn("Failed to check session lock state, exit code:", exitCode)
}
}
stdout: StdioCollector {
onStreamFinished: {
if (text.trim() === "LockedHint=yes") {
console.log("Session is locked on startup, activating lock screen")
loader.activeAsync = true
}
}
}
}
LazyLoader {
id: loader