mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
ipc wallpaper handler, fix high CPU usage
This commit is contained in:
@@ -101,38 +101,6 @@ Singleton {
|
||||
/* ──────────────── wallpaper change monitor ──────────────── */
|
||||
property string lastWallpaperTimestamp: ""
|
||||
|
||||
Timer {
|
||||
id: wallpaperMonitorTimer
|
||||
interval: 1000 // Check every second
|
||||
repeat: true
|
||||
|
||||
onTriggered: {
|
||||
wallpaperNotifyMonitor.reload()
|
||||
}
|
||||
}
|
||||
|
||||
FileView {
|
||||
id: wallpaperNotifyMonitor
|
||||
path: "file://" + notifyPath
|
||||
|
||||
onLoaded: {
|
||||
var timestamp = wallpaperNotifyMonitor.text()
|
||||
if (timestamp && timestamp !== lastWallpaperTimestamp) {
|
||||
console.log("Wallpaper change detected - updating dynamic theme")
|
||||
lastWallpaperTimestamp = timestamp
|
||||
|
||||
// Only update if we're currently using dynamic theme
|
||||
if (typeof Theme !== "undefined" && Theme.isDynamicTheme) {
|
||||
console.log("Triggering color extraction due to wallpaper change")
|
||||
extractColors()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onLoadFailed: {
|
||||
// File doesn't exist yet, this is normal
|
||||
}
|
||||
}
|
||||
|
||||
/* ──────────────── public helper ──────────────── */
|
||||
function extractColors() {
|
||||
|
||||
@@ -34,6 +34,15 @@ Singleton {
|
||||
|
||||
Component.onCompleted: loadSettings()
|
||||
|
||||
// Monitor system resources preference changes to control service monitoring
|
||||
onShowSystemResourcesChanged: {
|
||||
console.log("Prefs: System resources monitoring", showSystemResources ? "enabled" : "disabled")
|
||||
// Control SystemMonitorService based on whether system monitor widgets are visible
|
||||
if (typeof SystemMonitorService !== 'undefined') {
|
||||
SystemMonitorService.enableTopBarMonitoring(showSystemResources)
|
||||
}
|
||||
}
|
||||
|
||||
FileView {
|
||||
id: settingsFile
|
||||
path: StandardPaths.writableLocation(StandardPaths.ConfigLocation) + "/DankMaterialShell/settings.json"
|
||||
|
||||
Reference in New Issue
Block a user