1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

Optimize services to reduce load

This commit is contained in:
purian23
2025-07-29 21:56:41 -04:00
parent df147ff9b9
commit 35c6efdcc5
6 changed files with 134 additions and 6 deletions

View File

@@ -5,6 +5,7 @@ import QtQuick
import Quickshell
import Quickshell.Io
import qs.Common
import qs.Services
Singleton {
id: root
@@ -239,7 +240,7 @@ Singleton {
Timer {
id: updateTimer
interval: root.updateInterval
running: root.refCount > 0
running: root.refCount > 0 && !IdleService.isIdle
repeat: true
triggeredOnStart: true
onTriggered: {
@@ -247,6 +248,21 @@ Singleton {
}
}
Connections {
target: IdleService
function onIdleChanged(idle) {
if (idle) {
console.log("WeatherService: System idle, pausing weather updates")
} else {
console.log("WeatherService: System active, resuming weather updates")
if (root.refCount > 0 && !root.weather.available) {
// Trigger immediate update when coming back from idle if no data
root.fetchWeather()
}
}
}
}
Timer {
id: retryTimer
interval: root.retryDelay