1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-27 15:02:50 -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

@@ -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