diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-28 22:35:49 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-28 22:35:49 +1000 |
| commit | 40b43a49abbeabfa213b757a1040778767d9c58a (patch) | |
| tree | 1c1c34e24a2179cd45fe763c4c20225182ab78cf /services/SystemUsage.qml | |
| parent | dashboard: optimise cava (diff) | |
| download | caelestia-shell-40b43a49abbeabfa213b757a1040778767d9c58a.tar.gz caelestia-shell-40b43a49abbeabfa213b757a1040778767d9c58a.tar.bz2 caelestia-shell-40b43a49abbeabfa213b757a1040778767d9c58a.zip | |
dashboard: optimise systemusage
Ref same way as cava
Diffstat (limited to 'services/SystemUsage.qml')
| -rw-r--r-- | services/SystemUsage.qml | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/services/SystemUsage.qml b/services/SystemUsage.qml index 0eed3ef..4d80dc9 100644 --- a/services/SystemUsage.qml +++ b/services/SystemUsage.qml @@ -22,6 +22,8 @@ Singleton { property real lastCpuIdle property real lastCpuTotal + property int refCount + function formatKib(kib: real): var { const mib = 1024; const gib = 1024 ** 2; @@ -49,9 +51,10 @@ Singleton { } Timer { - running: true + running: root.refCount interval: 3000 repeat: true + triggeredOnStart: true onTriggered: { stat.reload(); meminfo.reload(); @@ -96,7 +99,6 @@ Singleton { Process { id: storage - running: true command: ["sh", "-c", "df | grep '^/dev/' | awk '{print $1, $3, $4}'"] stdout: StdioCollector { onStreamFinished: { @@ -142,17 +144,13 @@ Singleton { running: true command: ["sh", "-c", "if ls /sys/class/drm/card*/device/gpu_busy_percent 2>/dev/null | grep -q .; then echo GENERIC; elif command -v nvidia-smi >/dev/null; then echo NVIDIA; else echo NONE; fi"] stdout: StdioCollector { - onStreamFinished: { - root.gpuType = text.trim(); - gpuUsage.running = true; - } + onStreamFinished: root.gpuType = text.trim() } } Process { id: gpuUsage - running: true command: root.gpuType === "GENERIC" ? ["sh", "-c", "cat /sys/class/drm/card*/device/gpu_busy_percent"] : root.gpuType === "NVIDIA" ? ["nvidia-smi", "--query-gpu=utilization.gpu,temperature.gpu", "--format=csv,noheader,nounits"] : ["echo"] stdout: StdioCollector { onStreamFinished: { @@ -175,7 +173,6 @@ Singleton { Process { id: sensors - running: true command: ["sensors"] environment: ({ LANG: "C", |