perf: move temperature polling into nova-stats daemon; Temperature.qml is now pure display
This commit is contained in:
parent
dd5ca9d263
commit
3854763ce5
3 changed files with 32 additions and 17 deletions
|
|
@ -14,6 +14,9 @@ QtObject {
|
|||
property var cpuCoreMaxFreq: []
|
||||
property var cpuCoreTypes: []
|
||||
|
||||
// ── Temperature ──────────────────────────────────────────────────────
|
||||
property int tempCelsius: 0
|
||||
|
||||
// ── Memory ───────────────────────────────────────────────────────────
|
||||
property int memPercent: 0
|
||||
property real memUsedGb: 0
|
||||
|
|
@ -52,6 +55,8 @@ QtObject {
|
|||
history: hist.length > histLen ? hist.slice(hist.length - histLen) : hist
|
||||
};
|
||||
});
|
||||
} else if (ev.type === "temp") {
|
||||
root.tempCelsius = ev.celsius;
|
||||
} else if (ev.type === "mem") {
|
||||
root.memPercent = ev.percent;
|
||||
root.memUsedGb = ev.used_gb;
|
||||
|
|
|
|||
|
|
@ -1,39 +1,25 @@
|
|||
import QtQuick
|
||||
import Quickshell.Io
|
||||
import "." as M
|
||||
|
||||
M.BarSection {
|
||||
id: root
|
||||
spacing: Math.max(1, M.Theme.moduleSpacing - 2)
|
||||
tooltip: "Temperature: " + root.celsius + "\u00B0C"
|
||||
tooltip: "Temperature: " + M.SystemStats.tempCelsius + "\u00B0C"
|
||||
|
||||
property int celsius: 0
|
||||
property color _stateColor: celsius > (M.Modules.temperature.hot || 80) ? M.Theme.base09 : celsius > (M.Modules.temperature.warm || 60) ? M.Theme.base0A : root.accentColor
|
||||
property color _stateColor: M.SystemStats.tempCelsius > (M.Modules.temperature.hot || 80) ? M.Theme.base09 : M.SystemStats.tempCelsius > (M.Modules.temperature.warm || 60) ? M.Theme.base0A : root.accentColor
|
||||
Behavior on _stateColor {
|
||||
ColorAnimation {
|
||||
duration: 300
|
||||
}
|
||||
}
|
||||
|
||||
FileView {
|
||||
id: thermal
|
||||
path: "/sys/class/thermal/thermal_zone0/temp"
|
||||
onLoaded: root.celsius = Math.round(parseInt(text()) / 1000)
|
||||
}
|
||||
Timer {
|
||||
interval: M.Modules.temperature.interval || 2000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: thermal.reload()
|
||||
}
|
||||
|
||||
M.BarIcon {
|
||||
icon: "\uF2C9"
|
||||
color: root._stateColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
M.BarLabel {
|
||||
label: root.celsius + "\u00B0C"
|
||||
label: M.SystemStats.tempCelsius + "\u00B0C"
|
||||
minText: "100\u00B0C"
|
||||
color: root._stateColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue