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

Add ability to disable loginctl lock integration

This commit is contained in:
bbedward
2025-10-09 14:58:16 -04:00
parent 242e05cc0e
commit a4ceeafb1e
3 changed files with 45 additions and 1 deletions

View File

@@ -70,6 +70,7 @@ Singleton {
property int batteryHibernateTimeout: 0 // Never
property bool lockBeforeSuspend: false
property bool loginctlLockIntegration: true
property var recentColors: []
property bool showThirdPartyPlugins: false
@@ -152,6 +153,7 @@ Singleton {
batterySuspendTimeout = settings.batterySuspendTimeout !== undefined ? settings.batterySuspendTimeout : 0
batteryHibernateTimeout = settings.batteryHibernateTimeout !== undefined ? settings.batteryHibernateTimeout : 0
lockBeforeSuspend = settings.lockBeforeSuspend !== undefined ? settings.lockBeforeSuspend : false
loginctlLockIntegration = settings.loginctlLockIntegration !== undefined ? settings.loginctlLockIntegration : true
recentColors = settings.recentColors !== undefined ? settings.recentColors : []
showThirdPartyPlugins = settings.showThirdPartyPlugins !== undefined ? settings.showThirdPartyPlugins : false
@@ -215,6 +217,7 @@ Singleton {
"batterySuspendTimeout": batterySuspendTimeout,
"batteryHibernateTimeout": batteryHibernateTimeout,
"lockBeforeSuspend": lockBeforeSuspend,
"loginctlLockIntegration": loginctlLockIntegration,
"recentColors": recentColors,
"showThirdPartyPlugins": showThirdPartyPlugins
}, null, 2))
@@ -643,6 +646,11 @@ Singleton {
saveSettings()
}
function setLoginctlLockIntegration(enabled) {
loginctlLockIntegration = enabled
saveSettings()
}
function setShowThirdPartyPlugins(enabled) {
showThirdPartyPlugins = enabled
saveSettings()

View File

@@ -219,11 +219,20 @@ Item {
}
}
DankToggle {
width: parent.width
text: I18n.tr("Enable loginctl lock integration")
description: "Bind lock screen to dbus signals from loginctl. Disable if using an external lock screen."
checked: SessionData.loginctlLockIntegration
onToggled: checked => SessionData.setLoginctlLockIntegration(checked)
}
DankToggle {
width: parent.width
text: I18n.tr("Lock before suspend")
description: "Automatically lock the screen when the system prepares to suspend"
checked: SessionData.lockBeforeSuspend
visible: SessionData.loginctlLockIntegration
onToggled: checked => SessionData.setLockBeforeSuspend(checked)
}

View File

@@ -61,6 +61,10 @@ Singleton {
detectHibernateProcess.running = true
detectPrimeRunProcess.running = true
console.log("SessionService: Native inhibitor available:", nativeInhibitorAvailable)
if (!SessionData.loginctlLockIntegration) {
console.log("SessionService: loginctl lock integration disabled by user")
return
}
if (socketPath && socketPath.length > 0) {
checkDMSCapabilities()
} else {
@@ -291,10 +295,29 @@ Singleton {
}
}
Connections {
target: SessionData
function onLoginctlLockIntegrationChanged() {
if (SessionData.loginctlLockIntegration) {
if (socketPath && socketPath.length > 0) {
checkDMSCapabilities()
} else {
initFallbackLoginctl()
}
} else {
subscriptionSocket.connected = false
lockStateMonitorFallback.running = false
loginctlAvailable = false
stateInitialized = false
}
}
}
DankSocket {
id: subscriptionSocket
path: root.socketPath
connected: loginctlAvailable
connected: loginctlAvailable && SessionData.loginctlLockIntegration
onConnectionStateChanged: {
root.subscriptionConnected = connected
@@ -342,6 +365,10 @@ Singleton {
return
}
if (!SessionData.loginctlLockIntegration) {
return
}
if (DMSService.capabilities.includes("loginctl")) {
loginctlAvailable = true
if (!stateInitialized) {