From 2cb4d9b739c33571acf4b27665b4e4465ef87f79 Mon Sep 17 00:00:00 2001 From: zach Date: Wed, 17 Jun 2026 18:53:23 +0200 Subject: [PATCH] revert sensors process removal --- Helpers/SystemUsage.qml | 42 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/Helpers/SystemUsage.qml b/Helpers/SystemUsage.qml index 7e8881e..b13402d 100644 --- a/Helpers/SystemUsage.qml +++ b/Helpers/SystemUsage.qml @@ -58,8 +58,10 @@ Singleton { triggeredOnStart: true onTriggered: { - if (root.gpuType === "GENERIC") + if (root.gpuType === "GENERIC") { gpuUsage.running = true; + sensors.running = true; + } if (root.gpuType === "GENERIC" && root.gpuMemTotal === 0) oneshotMemAmd.running = true; @@ -226,4 +228,42 @@ Singleton { } } } + + Process { + id: sensors + + command: ["sensors"] + environment: ({ + LANG: "C.UTF-8", + LC_ALL: "C.UTF-8" + }) + + stdout: StdioCollector { + onStreamFinished: { + let eligible = false; + let sum = 0; + let count = 0; + + for (const line of text.trim().split("\n")) { + if (line === "Adapter: PCI adapter") + eligible = true; + else if (line === "") + eligible = false; + else if (eligible) { + let match = line.match(/^(temp[0-9]+|GPU core|edge)+:\s+\+([0-9]+\.[0-9]+)(°| )C/); + if (!match) + // Fall back to junction/mem if GPU doesn't have edge temp (for AMD GPUs) + match = line.match(/^(junction|mem)+:\s+\+([0-9]+\.[0-9]+)(°| )C/); + + if (match) { + sum += parseFloat(match[2]); + count++; + } + } + } + + root.gpuTemp = count > 0 ? sum / count : 0; + } + } + } }