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
command: ["bluetoothctl", "show"]
environment: ({
LANG: "C.UTF-8",
LC_ALL: "C.UTF-8"
LANG: "C",
LC_ALL: "C"
})
stdout: StdioCollector {
onStreamFinished: {
@ -51,8 +51,8 @@ Singleton {
end
end`]
environment: ({
LANG: "C.UTF-8",
LC_ALL: "C.UTF-8"
LANG: "C",
LC_ALL: "C"
})
stdout: StdioCollector {
onStreamFinished: {

View file

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

View file

@ -55,9 +55,8 @@ Singleton {
stat.reload();
meminfo.reload();
storage.running = true;
cpuTemp.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 {
id: gpuUsage
@ -165,12 +150,20 @@ Singleton {
}
Process {
id: gpuTemp
id: sensors
running: true
command: ["sensors"]
environment: ({
LANG: "C",
LC_ALL: "C"
})
stdout: StdioCollector {
onStreamFinished: {
const cpuTemp = text.match(/Package id [0-9]+: *((\+|-)[0-9.]+)(°| )C/);
if (cpuTemp)
root.cpuTemp = parseFloat(cpuTemp[1]);
let eligible = false;
let sum = 0;
let count = 0;