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