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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user