temperature: per-device breakdown in panel, device filter config option
This commit is contained in:
parent
8bbe211dd4
commit
88a0886681
6 changed files with 144 additions and 16 deletions
|
|
@ -56,7 +56,8 @@ QtObject {
|
|||
property var temperature: ({
|
||||
enable: true,
|
||||
warm: 80,
|
||||
hot: 90
|
||||
hot: 90,
|
||||
device: ""
|
||||
})
|
||||
property var gpu: ({
|
||||
enable: true
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ QtObject {
|
|||
|
||||
// ── Temperature ──────────────────────────────────────────────────────
|
||||
property int tempCelsius: 0
|
||||
property var tempHistory: [] // 150 samples @ 4s each ≈ 10 min
|
||||
property var tempHistory: [] // 150 samples @ 4s each ≈ 10 min
|
||||
property var tempDevices: [] // [{name, celsius}] sorted hottest-first
|
||||
|
||||
// ── GPU ──────────────────────────────────────────────────────────────
|
||||
property bool gpuAvailable: false
|
||||
|
|
@ -95,6 +96,8 @@ QtObject {
|
|||
root.tempCelsius = ev.celsius;
|
||||
const th = root.tempHistory.concat([ev.celsius]);
|
||||
root.tempHistory = th.length > 150 ? th.slice(th.length - 150) : th;
|
||||
if (ev.devices)
|
||||
root.tempDevices = ev.devices;
|
||||
} else if (ev.type === "gpu") {
|
||||
root.gpuAvailable = true;
|
||||
root.gpuVendor = ev.vendor;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,17 @@ M.BarSection {
|
|||
|
||||
readonly property int _warm: M.Modules.temperature.warm || 80
|
||||
readonly property int _hot: M.Modules.temperature.hot || 90
|
||||
readonly property int _temp: M.SystemStats.tempCelsius
|
||||
readonly property string _deviceFilter: M.Modules.temperature.device || ""
|
||||
|
||||
// If a device filter is set, use that device's temp; otherwise fall back to system max
|
||||
readonly property int _temp: {
|
||||
if (_deviceFilter !== "") {
|
||||
const dev = M.SystemStats.tempDevices.find(d => d.name === _deviceFilter);
|
||||
if (dev)
|
||||
return dev.celsius;
|
||||
}
|
||||
return M.SystemStats.tempCelsius;
|
||||
}
|
||||
|
||||
property color _stateColor: _temp > _hot ? M.Theme.base08 : _temp > _warm ? M.Theme.base0A : root.accentColor
|
||||
Behavior on _stateColor {
|
||||
|
|
@ -257,6 +267,57 @@ M.BarSection {
|
|||
}
|
||||
}
|
||||
|
||||
// Per-device breakdown
|
||||
Rectangle {
|
||||
width: parent.width - 16
|
||||
height: 1
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
color: M.Theme.base03
|
||||
visible: M.SystemStats.tempDevices.length > 0
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: M.SystemStats.tempDevices
|
||||
delegate: Item {
|
||||
required property var modelData
|
||||
width: hoverPanel.contentWidth
|
||||
height: 22
|
||||
|
||||
readonly property bool _isActive: root._deviceFilter === modelData.name
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 8
|
||||
anchors.rightMargin: 8
|
||||
color: _isActive ? Qt.rgba(root.accentColor.r, root.accentColor.g, root.accentColor.b, 0.12) : "transparent"
|
||||
radius: 3
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: modelData.name
|
||||
color: _isActive ? root.accentColor : M.Theme.base04
|
||||
font.pixelSize: M.Theme.fontSize - 2
|
||||
font.family: M.Theme.fontFamily
|
||||
elide: Text.ElideRight
|
||||
width: parent.width - 80
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: modelData.celsius + "\u00B0C"
|
||||
color: root._tempColor(modelData.celsius)
|
||||
font.pixelSize: M.Theme.fontSize - 2
|
||||
font.family: M.Theme.fontFamily
|
||||
font.bold: _isActive
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
width: 1
|
||||
height: 4
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue