mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
config: restructure, migration system, cache data
This commit is contained in:
@@ -23,10 +23,10 @@ Singleton {
|
||||
property bool _enableGate: true
|
||||
|
||||
readonly property bool isOnBattery: BatteryService.batteryAvailable && !BatteryService.isPluggedIn
|
||||
readonly property int monitorTimeout: isOnBattery ? SessionData.batteryMonitorTimeout : SessionData.acMonitorTimeout
|
||||
readonly property int lockTimeout: isOnBattery ? SessionData.batteryLockTimeout : SessionData.acLockTimeout
|
||||
readonly property int suspendTimeout: isOnBattery ? SessionData.batterySuspendTimeout : SessionData.acSuspendTimeout
|
||||
readonly property int hibernateTimeout: isOnBattery ? SessionData.batteryHibernateTimeout : SessionData.acHibernateTimeout
|
||||
readonly property int monitorTimeout: isOnBattery ? SettingsData.batteryMonitorTimeout : SettingsData.acMonitorTimeout
|
||||
readonly property int lockTimeout: isOnBattery ? SettingsData.batteryLockTimeout : SettingsData.acLockTimeout
|
||||
readonly property int suspendTimeout: isOnBattery ? SettingsData.batterySuspendTimeout : SettingsData.acSuspendTimeout
|
||||
readonly property int hibernateTimeout: isOnBattery ? SettingsData.batteryHibernateTimeout : SettingsData.acHibernateTimeout
|
||||
|
||||
onMonitorTimeoutChanged: _rearmIdleMonitors()
|
||||
onLockTimeoutChanged: _rearmIdleMonitors()
|
||||
@@ -139,7 +139,7 @@ Singleton {
|
||||
Connections {
|
||||
target: SessionService
|
||||
function onPrepareForSleep() {
|
||||
if (SessionData.lockBeforeSuspend) {
|
||||
if (SettingsData.lockBeforeSuspend) {
|
||||
root.lockRequested()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ Singleton {
|
||||
detectHibernateProcess.running = true
|
||||
detectPrimeRunProcess.running = true
|
||||
console.log("SessionService: Native inhibitor available:", nativeInhibitorAvailable)
|
||||
if (!SessionData.loginctlLockIntegration) {
|
||||
if (!SettingsData.loginctlLockIntegration) {
|
||||
console.log("SessionService: loginctl lock integration disabled by user")
|
||||
return
|
||||
}
|
||||
@@ -142,8 +142,8 @@ Singleton {
|
||||
if (usePrimeRun && hasPrimeRun) {
|
||||
cmd = ["prime-run"].concat(cmd)
|
||||
}
|
||||
if (SessionData.launchPrefix && SessionData.launchPrefix.length > 0) {
|
||||
const launchPrefix = SessionData.launchPrefix.trim().split(" ")
|
||||
if (SettingsData.launchPrefix && SettingsData.launchPrefix.length > 0) {
|
||||
const launchPrefix = SettingsData.launchPrefix.trim().split(" ")
|
||||
cmd = launchPrefix.concat(cmd)
|
||||
}
|
||||
|
||||
@@ -158,8 +158,8 @@ Singleton {
|
||||
if (usePrimeRun && hasPrimeRun) {
|
||||
cmd = ["prime-run"].concat(cmd)
|
||||
}
|
||||
if (SessionData.launchPrefix && SessionData.launchPrefix.length > 0) {
|
||||
const launchPrefix = SessionData.launchPrefix.trim().split(" ")
|
||||
if (SettingsData.launchPrefix && SettingsData.launchPrefix.length > 0) {
|
||||
const launchPrefix = SettingsData.launchPrefix.trim().split(" ")
|
||||
cmd = launchPrefix.concat(cmd)
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ Singleton {
|
||||
target: SessionData
|
||||
|
||||
function onLoginctlLockIntegrationChanged() {
|
||||
if (SessionData.loginctlLockIntegration) {
|
||||
if (SettingsData.loginctlLockIntegration) {
|
||||
if (socketPath && socketPath.length > 0 && loginctlAvailable) {
|
||||
if (!stateInitialized) {
|
||||
stateInitialized = true
|
||||
@@ -311,7 +311,7 @@ Singleton {
|
||||
}
|
||||
|
||||
function onLockBeforeSuspendChanged() {
|
||||
if (SessionData.loginctlLockIntegration) {
|
||||
if (SettingsData.loginctlLockIntegration) {
|
||||
syncLockBeforeSuspend()
|
||||
}
|
||||
}
|
||||
@@ -319,7 +319,7 @@ Singleton {
|
||||
|
||||
Connections {
|
||||
target: DMSService
|
||||
enabled: SessionData.loginctlLockIntegration
|
||||
enabled: SettingsData.loginctlLockIntegration
|
||||
|
||||
function onLoginctlStateUpdate(data) {
|
||||
updateLoginctlState(data)
|
||||
@@ -341,7 +341,7 @@ Singleton {
|
||||
|
||||
if (DMSService.capabilities.includes("loginctl")) {
|
||||
loginctlAvailable = true
|
||||
if (SessionData.loginctlLockIntegration && !stateInitialized) {
|
||||
if (SettingsData.loginctlLockIntegration && !stateInitialized) {
|
||||
stateInitialized = true
|
||||
getLoginctlState()
|
||||
syncLockBeforeSuspend()
|
||||
@@ -366,12 +366,12 @@ Singleton {
|
||||
if (!loginctlAvailable) return
|
||||
|
||||
DMSService.sendRequest("loginctl.setLockBeforeSuspend", {
|
||||
enabled: SessionData.lockBeforeSuspend
|
||||
enabled: SettingsData.lockBeforeSuspend
|
||||
}, response => {
|
||||
if (response.error) {
|
||||
console.warn("SessionService: Failed to sync lock before suspend:", response.error)
|
||||
} else {
|
||||
console.log("SessionService: Synced lock before suspend:", SessionData.lockBeforeSuspend)
|
||||
console.log("SessionService: Synced lock before suspend:", SettingsData.lockBeforeSuspend)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user