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

loginctl: disable inhibit when loginctl integration disabled

This commit is contained in:
bbedward
2025-10-15 09:58:44 -04:00
parent 23ef19e683
commit 342cd55bc0
2 changed files with 24 additions and 0 deletions

View File

@@ -40,6 +40,7 @@ Singleton {
signal networkStateUpdate(var data)
signal loginctlStateUpdate(var data)
signal loginctlEvent(var event)
signal capabilitiesReceived()
Component.onCompleted: {
if (socketPath && socketPath.length > 0) {
@@ -256,6 +257,8 @@ Singleton {
if (apiVersion < expectedApiVersion) {
ToastService.showError("DMS server is outdated (API v" + apiVersion + ", expected v" + expectedApiVersion + ")")
}
capabilitiesReceived()
} else if (service === "network") {
networkStateUpdate(data)
} else if (service === "loginctl") {

View File

@@ -302,6 +302,10 @@ Singleton {
checkDMSCapabilities()
}
}
function onCapabilitiesReceived() {
syncSleepInhibitor()
}
}
Connections {
@@ -328,6 +332,7 @@ Singleton {
} else {
stateInitialized = false
}
syncSleepInhibitor()
}
function onLockBeforeSuspendChanged() {
@@ -396,6 +401,22 @@ Singleton {
})
}
function syncSleepInhibitor() {
if (!loginctlAvailable) return
if (!DMSService.apiVersion || DMSService.apiVersion < 4) return
DMSService.sendRequest("loginctl.setSleepInhibitorEnabled", {
enabled: SettingsData.loginctlLockIntegration
}, response => {
if (response.error) {
console.warn("SessionService: Failed to sync sleep inhibitor:", response.error)
} else {
console.log("SessionService: Synced sleep inhibitor:", SettingsData.loginctlLockIntegration)
}
})
}
function updateLoginctlState(state) {
const wasLocked = locked