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:
@@ -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") {
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user