1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

fix process monitor CPU calculations

This commit is contained in:
bbedward
2025-08-02 14:55:33 -04:00
parent 21c40b58bc
commit 2cf7497324
2 changed files with 63 additions and 71 deletions

View File

@@ -29,13 +29,9 @@ Column {
spacing: Theme.spacingM
Component.onCompleted: {
SysMonitorService.addRef();
SysMonitorService.addRef();
// Trigger immediate updates for both services
SysMonitorService.updateAllStats();
}
Component.onDestruction: {
SysMonitorService.removeRef();
SysMonitorService.removeRef();
}
Rectangle {
@@ -107,7 +103,7 @@ Column {
spacing: 6
Repeater {
model: SysMonitorService.perCoreCpuUsage.length
model: SysMonitorService.perCoreCpuUsage
Row {
width: parent.width
@@ -130,11 +126,11 @@ Column {
anchors.verticalCenter: parent.verticalCenter
Rectangle {
width: parent.width * Math.min(1, SysMonitorService.perCoreCpuUsage[index] / 100)
width: parent.width * Math.min(1, modelData / 100)
height: parent.height
radius: parent.radius
color: {
const usage = SysMonitorService.perCoreCpuUsage[index];
const usage = modelData;
if (usage > 80)
return Theme.error;
@@ -156,7 +152,7 @@ Column {
}
StyledText {
text: SysMonitorService.perCoreCpuUsage[index] ? SysMonitorService.perCoreCpuUsage[index].toFixed(0) + "%" : "0%"
text: modelData ? modelData.toFixed(0) + "%" : "0%"
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
color: Theme.surfaceText