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

Implement some data smoothing

This commit is contained in:
bbedward
2025-08-09 17:26:57 -04:00
parent b3310e3edd
commit 8bef7ded1e
5 changed files with 69 additions and 18 deletions

View File

@@ -71,7 +71,7 @@ Column {
anchors.verticalCenter: parent.verticalCenter
StyledText {
text: DankgopService.cpuUsage.toFixed(1) + "%"
text: DankgopService.smoothedCpuUsage.toFixed(1) + "%"
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Bold
color: Theme.primary

View File

@@ -62,10 +62,10 @@ Rectangle {
name: DankgopService.getProcessIcon(process ? process.command : "")
size: Theme.iconSize - 4
color: {
if (process && process.cpu > 80)
if (process && process.smoothedCpu > 80)
return Theme.error
if (process && process.cpu > 50)
if (process && process.smoothedCpu > 50)
return Theme.warning
return Theme.surfaceText
@@ -95,10 +95,10 @@ Rectangle {
height: 20
radius: Theme.cornerRadius
color: {
if (process && process.cpu > 80)
if (process && process.smoothedCpu > 80)
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12)
if (process && process.cpu > 50)
if (process && process.smoothedCpu > 50)
return Qt.rgba(Theme.warning.r, Theme.warning.g,
Theme.warning.b, 0.12)
@@ -110,15 +110,15 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter
StyledText {
text: DankgopService.formatCpuUsage(process ? process.cpu : 0)
text: DankgopService.formatCpuUsage(process ? process.smoothedCpu : 0)
font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily
font.weight: Font.Bold
color: {
if (process && process.cpu > 80)
if (process && process.smoothedCpu > 80)
return Theme.error
if (process && process.cpu > 50)
if (process && process.smoothedCpu > 50)
return Theme.warning
return Theme.surfaceText

View File

@@ -57,9 +57,9 @@ Row {
StyledText {
text: {
if (DankgopService.cpuUsage === undefined || DankgopService.cpuUsage === null)
if (DankgopService.smoothedCpuUsage === undefined || DankgopService.smoothedCpuUsage === null)
return "--%"
return DankgopService.cpuUsage.toFixed(1) + "%"
return DankgopService.smoothedCpuUsage.toFixed(1) + "%"
}
font.pixelSize: Theme.fontSizeLarge
font.family: SettingsData.monoFontFamily

View File

@@ -59,10 +59,10 @@ Rectangle {
name: "memory"
size: Theme.iconSize - 8
color: {
if (DankgopService.cpuUsage > 80)
if (DankgopService.smoothedCpuUsage > 80)
return Theme.tempDanger
if (DankgopService.cpuUsage > 60)
if (DankgopService.smoothedCpuUsage > 60)
return Theme.tempWarning
return Theme.surfaceText
@@ -72,12 +72,12 @@ Rectangle {
StyledText {
text: {
if (DankgopService.cpuUsage === undefined
|| DankgopService.cpuUsage === null
|| DankgopService.cpuUsage === 0) {
if (DankgopService.smoothedCpuUsage === undefined
|| DankgopService.smoothedCpuUsage === null
|| DankgopService.smoothedCpuUsage === 0) {
return "--%"
}
return DankgopService.cpuUsage.toFixed(0) + "%"
return DankgopService.smoothedCpuUsage.toFixed(0) + "%"
}
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium