From f7e4b82cf17a6571e3cca8bc57cd20a28bbe3ea8 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Tue, 15 Jul 2025 19:19:47 +0800 Subject: stats: highlight significant usages --- bar/Network.qml | 16 ++++++++++++++-- bar/Resources.qml | 18 ++++++++++++++---- 2 files changed, 28 insertions(+), 6 deletions(-) (limited to 'bar') diff --git a/bar/Network.qml b/bar/Network.qml index 46e73c2..9c92f7b 100644 --- a/bar/Network.qml +++ b/bar/Network.qml @@ -6,6 +6,14 @@ import qs.components import qs.config Item { + id: root + property int down: Services.NetworkUsage.down + property string downUnit: Services.NetworkUsage.downUnit + property int up: Services.NetworkUsage.up + property string upUnit: Services.NetworkUsage.upUnit + + property int significantUsage: 30 + property string usageUnit: "M" implicitWidth: container.implicitWidth implicitHeight: container.implicitHeight - General.rectMargin @@ -43,20 +51,24 @@ Item { spacing: Bar.resourceIconTextSpacing / 2 IText { text: Icons.resource.network.download + color: root.downUnit == root.usageUnit && root.down > root.significantUsage ? Colors.cyan : WallustColors.foreground } IText { animate: true - text: Services.NetworkUsage.down + Services.NetworkUsage.downUnit + text: root.down + root.downUnit + color: root.downUnit == root.usageUnit && root.down > root.significantUsage ? Colors.cyan : WallustColors.foreground } } RowLayout { spacing: Bar.resourceIconTextSpacing / 2 IText { text: Icons.resource.network.upload + color: root.upUnit == root.usageUnit && root.up > root.significantUsage ? Colors.cyan : WallustColors.foreground } IText { animate: true - text: Services.NetworkUsage.up + Services.NetworkUsage.upUnit + text: root.up + root.upUnit + color: root.upUnit == root.usageUnit && root.up > root.significantUsage ? Colors.cyan : WallustColors.foreground } } diff --git a/bar/Resources.qml b/bar/Resources.qml index d66fed6..3e393e4 100644 --- a/bar/Resources.qml +++ b/bar/Resources.qml @@ -21,20 +21,30 @@ Item { id: layout anchors.centerIn: parent SimpleResource { - text: Math.round(Services.Resource.cpuUsage * 100) + "%" + value: Services.Resource.cpuUsage + suffix: "%" icon: Config.Icons.resource.cpu } SimpleResource { icon: Config.Icons.resource.memory - text: Math.round(Services.Resource.memoryUsedPercentage * 100) + "%" + value: Services.Resource.memoryUsedPercentage + suffix: "%" } SimpleResource { icon: Config.Icons.resource.gpu - text: Services.Resource.gpuUsage + "%" + value: Services.Resource.gpuUsage / 100 + suffix: "%" + thresholdL1: 0.60 + thresholdL2: 0.70 + thresholdL3: 0.80 } SimpleResource { icon: Config.Icons.resource.temp - text: Math.round(Services.Resource.cpuTemp * 100) + "°C" + value: Services.Resource.cpuTemp + suffix: "°C" + thresholdL1: 0.60 + thresholdL2: 0.80 + thresholdL3: 0.90 } } } -- cgit v1.2.3