systemusage: use sensors for cpu temps

Also fix lang and lc_all for procs
This commit is contained in:
2 * r + 2 * t 2025-06-22 13:22:45 +10:00
parent b13b6de9d8
commit 7f2b5b4b6f
3 changed files with 16 additions and 23 deletions

View file

@ -28,8 +28,8 @@ Singleton {
running: true running: true
command: ["bluetoothctl", "show"] command: ["bluetoothctl", "show"]
environment: ({ environment: ({
LANG: "C.UTF-8", LANG: "C",
LC_ALL: "C.UTF-8" LC_ALL: "C"
}) })
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: { onStreamFinished: {
@ -51,8 +51,8 @@ Singleton {
end end
end`] end`]
environment: ({ environment: ({
LANG: "C.UTF-8", LANG: "C",
LC_ALL: "C.UTF-8" LC_ALL: "C"
}) })
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: { onStreamFinished: {

View file

@ -25,8 +25,8 @@ Singleton {
running: true running: true
command: ["nmcli", "-g", "ACTIVE,SIGNAL,FREQ,SSID,BSSID", "d", "w"] command: ["nmcli", "-g", "ACTIVE,SIGNAL,FREQ,SSID,BSSID", "d", "w"]
environment: ({ environment: ({
LANG: "C.UTF-8", LANG: "C",
LC_ALL: "C.UTF-8" LC_ALL: "C"
}) })
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: { onStreamFinished: {

View file

@ -55,9 +55,8 @@ Singleton {
stat.reload(); stat.reload();
meminfo.reload(); meminfo.reload();
storage.running = true; storage.running = true;
cpuTemp.running = true;
gpuUsage.running = true; gpuUsage.running = true;
gpuTemp.running = true; sensors.running = true;
} }
} }
@ -136,20 +135,6 @@ Singleton {
} }
} }
Process {
id: cpuTemp
running: true
command: ["sh", "-c", "cat /sys/class/thermal/thermal_zone*/temp"]
stdout: StdioCollector {
onStreamFinished: {
const temps = text.trim().split(" ");
const sum = temps.reduce((acc, d) => acc + parseInt(d, 10), 0);
root.cpuTemp = sum / temps.length / 1000;
}
}
}
Process { Process {
id: gpuUsage id: gpuUsage
@ -165,12 +150,20 @@ Singleton {
} }
Process { Process {
id: gpuTemp id: sensors
running: true running: true
command: ["sensors"] command: ["sensors"]
environment: ({
LANG: "C",
LC_ALL: "C"
})
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: { onStreamFinished: {
const cpuTemp = text.match(/Package id [0-9]+: *((\+|-)[0-9.]+)(°| )C/);
if (cpuTemp)
root.cpuTemp = parseFloat(cpuTemp[1]);
let eligible = false; let eligible = false;
let sum = 0; let sum = 0;
let count = 0; let count = 0;