1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-26 14:32:52 -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

@@ -4,12 +4,13 @@ pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import Quickshell.Io
import qs.Services
Singleton {
id: root
property int refCount: 0
property int updateInterval: 8000
property int updateInterval: 30000
property int maxProcesses: 100
property bool isUpdating: false
@@ -360,11 +361,26 @@ Singleton {
Timer {
id: updateTimer
interval: root.updateInterval
running: root.refCount > 0
running: root.refCount > 0 && !IdleService.isIdle
repeat: true
triggeredOnStart: true
onTriggered: root.updateAllStats()
}
Connections {
target: IdleService
function onIdleChanged(idle) {
if (idle) {
console.log("SysMonitorService: System idle, pausing monitoring")
} else {
console.log("SysMonitorService: System active, resuming monitoring")
if (root.refCount > 0) {
// Trigger immediate update when coming back from idle
root.updateAllStats()
}
}
}
}
readonly property string scriptBody: `set -Eeuo pipefail
trap 'echo "ERR at line $LINENO: $BASH_COMMAND (exit $?)" >&2' ERR