From 03554e5ad3a7c2e3ce5ef1abd212218b6dbdc1e0 Mon Sep 17 00:00:00 2001 From: Damocles Date: Mon, 13 Apr 2026 22:20:56 +0200 Subject: [PATCH 1/2] =?UTF-8?q?cpu=20panel:=20interpolate=20bar=20color=20?= =?UTF-8?q?green=E2=86=92yellow=E2=86=92red=20by=20load?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/Cpu.qml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/Cpu.qml b/modules/Cpu.qml index 5705c08..d49a9fc 100644 --- a/modules/Cpu.qml +++ b/modules/Cpu.qml @@ -102,6 +102,14 @@ M.BarSection { onTriggered: root._pinned = false } + function _loadColor(pct) { + const t = Math.max(0, Math.min(100, pct)) / 100; + const a = t < 0.5 ? M.Theme.base0B : M.Theme.base0A; + const b = t < 0.5 ? M.Theme.base0A : M.Theme.base08; + const u = t < 0.5 ? t * 2 : (t - 0.5) * 2; + return Qt.rgba(a.r + (b.r - a.r) * u, a.g + (b.g - a.g) * u, a.b + (b.b - a.b) * u, 1); + } + M.BarIcon { icon: "\uF2DB" anchors.verticalCenter: parent.verticalCenter @@ -167,6 +175,7 @@ M.BarSection { readonly property int _u: root._coreUsage[index] ?? 0 readonly property real _f: root._coreFreq[index] ?? 0 + readonly property color _barColor: root._loadColor(_u) Text { id: coreLabel @@ -197,7 +206,7 @@ M.BarSection { Rectangle { width: parent.width * (parent.parent._u / 100) height: parent.height - color: root.accentColor + color: parent.parent._barColor radius: 2 Behavior on width { NumberAnimation { @@ -213,7 +222,7 @@ M.BarSection { anchors.rightMargin: 12 anchors.verticalCenter: parent.verticalCenter text: parent._f.toFixed(2) - color: M.Theme.base04 + color: parent._barColor font.pixelSize: M.Theme.fontSize - 2 font.family: M.Theme.fontFamily width: 32 From 26de0d6c4f625c6b08d12123b0c0290781f51fea Mon Sep 17 00:00:00 2001 From: Damocles Date: Mon, 13 Apr 2026 22:21:58 +0200 Subject: [PATCH 2/2] fix duplicate on_AnyHoverChanged in Volume.qml --- modules/Volume.qml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/Volume.qml b/modules/Volume.qml index 98cac53..551cf8b 100644 --- a/modules/Volume.qml +++ b/modules/Volume.qml @@ -50,7 +50,13 @@ M.BarSection { } on_ExpandedChanged: console.log("[vol] expanded →", _expanded) - on_AnyHoverChanged: console.log("[vol] anyHover →", _anyHover, "| barHover:", root._hovered, "| panelHover:", hoverPanel.panelHovered) + on_AnyHoverChanged: { + console.log("[vol] anyHover →", _anyHover, "| barHover:", root._hovered, "| panelHover:", hoverPanel.panelHovered); + if (_anyHover) + _collapseTimer.stop(); + else if (_expanded) + _collapseTimer.start(); + } onVolumeChanged: _flashPanel() onMutedChanged: _flashPanel() @@ -66,13 +72,6 @@ M.BarSection { onTriggered: root._osdActive = false } - on_AnyHoverChanged: { - if (_anyHover) - _collapseTimer.stop(); - else if (_expanded) - _collapseTimer.start(); - } - Timer { id: _collapseTimer interval: 1500