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:
@@ -13,6 +13,35 @@ Item {
|
|||||||
loader.activeAsync = true
|
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 {
|
LazyLoader {
|
||||||
id: loader
|
id: loader
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user