systemusage: fix CPU temps for AMD CPUs (#150)

This commit is contained in:
Alexandre C. 2025-06-24 03:02:07 +02:00 committed by GitHub
parent 2a68d79422
commit 113134d61d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -160,7 +160,11 @@ Singleton {
}) })
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: { onStreamFinished: {
const cpuTemp = text.match(/Package id [0-9]+: *((\+|-)[0-9.]+)(°| )C/); const cpuTemp = text.match(/(?:Package id [0-9]+|Tdie):\s+((\+|-)[0-9.]+)(°| )C/);
if (!cpuTemp) {
// If AMD Tdie pattern failed, try fallback on Tctl
const cpuTemp = text.match(/Tctl:\s+((\+|-)[0-9.]+)(°| )C/);
}
if (cpuTemp) if (cpuTemp)
root.cpuTemp = parseFloat(cpuTemp[1]); root.cpuTemp = parseFloat(cpuTemp[1]);