mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
SystemStat: added optional swap usage
This commit is contained in:
@@ -209,6 +209,8 @@
|
||||
"network-traffic-label": "Netzwerkverkehr",
|
||||
"storage-usage-description": "Festplattenspeicher-Nutzungsinformationen anzeigen.",
|
||||
"storage-usage-label": "Speichernutzung",
|
||||
"swap-usage-description": "Swap-Speichernutzung anzeigen.",
|
||||
"swap-usage-label": "Swap-Nutzung",
|
||||
"use-monospace-font-description": "Verwende eine Monospace-Schriftart für eine konsistente Zeichenbreite.",
|
||||
"use-monospace-font-label": "Schriftart mit fester Breite"
|
||||
},
|
||||
|
||||
@@ -209,6 +209,8 @@
|
||||
"network-traffic-label": "Network traffic",
|
||||
"storage-usage-description": "Show disk space usage information.",
|
||||
"storage-usage-label": "Storage usage",
|
||||
"swap-usage-description": "Show swap memory usage.",
|
||||
"swap-usage-label": "Swap usage",
|
||||
"use-monospace-font-description": "Use monospace font for consistent character width.",
|
||||
"use-monospace-font-label": "Monospace font"
|
||||
},
|
||||
@@ -679,10 +681,10 @@
|
||||
"volumes-output-volume-description": "System-wide volume level.",
|
||||
"volumes-step-size-description": "Adjust the step size for volume changes (scroll wheel, keyboard shortcuts).",
|
||||
"volumes-step-size-label": "Volume step size",
|
||||
"volumes-volume-overdrive-description": "Allow raising volume above 100%. May not be supported by all hardware.",
|
||||
"volumes-volume-overdrive-label": "Allow volume overdrive",
|
||||
"volumes-volume-feedback-description": "Play a feedback sound when adjusting volume",
|
||||
"volumes-volume-feedback-label": "Play volume feedback sound",
|
||||
"volumes-volume-feedback-description": "Play a feedback sound when adjusting volume"
|
||||
"volumes-volume-overdrive-description": "Allow raising volume above 100%. May not be supported by all hardware.",
|
||||
"volumes-volume-overdrive-label": "Allow volume overdrive"
|
||||
},
|
||||
"bar": {
|
||||
"appearance-background-opacity-description": "Set the background opacity specifically for the bar.",
|
||||
|
||||
@@ -209,6 +209,8 @@
|
||||
"network-traffic-label": "Tráfico de red",
|
||||
"storage-usage-description": "Mostrar la información del uso del espacio en disco.",
|
||||
"storage-usage-label": "Uso de almacenamiento",
|
||||
"swap-usage-description": "Mostrar el uso de la memoria swap.",
|
||||
"swap-usage-label": "Uso de swap",
|
||||
"use-monospace-font-description": "Utilice fuente monoespaciada para un ancho de carácter consistente.",
|
||||
"use-monospace-font-label": "Fuente monoespaciada"
|
||||
},
|
||||
|
||||
@@ -209,6 +209,8 @@
|
||||
"network-traffic-label": "Trafic réseau",
|
||||
"storage-usage-description": "Afficher les informations d'utilisation de l'espace disque.",
|
||||
"storage-usage-label": "Utilisation du stockage",
|
||||
"swap-usage-description": "Afficher l'utilisation de la mémoire swap.",
|
||||
"swap-usage-label": "Utilisation du swap",
|
||||
"use-monospace-font-description": "Utilisez une police de caractères à chasse fixe pour une largeur de caractère uniforme.",
|
||||
"use-monospace-font-label": "Police à chasse fixe"
|
||||
},
|
||||
|
||||
@@ -209,6 +209,8 @@
|
||||
"network-traffic-label": "Hálózati forgalom",
|
||||
"storage-usage-description": "Lemezterület-használati információk megjelenítése.",
|
||||
"storage-usage-label": "Tárhelyhasználat",
|
||||
"swap-usage-description": "Swap memória használatának megjelenítése.",
|
||||
"swap-usage-label": "Swap használat",
|
||||
"use-monospace-font-description": "Használj monospace betűtípust az egységes karakter-szélességhez.",
|
||||
"use-monospace-font-label": "Monospace betűtípus"
|
||||
},
|
||||
|
||||
@@ -209,6 +209,8 @@
|
||||
"network-traffic-label": "ネットワークトラフィック",
|
||||
"storage-usage-description": "ストレージの使用状況を表示します。",
|
||||
"storage-usage-label": "ストレージ使用量",
|
||||
"swap-usage-description": "スワップメモリの使用状況を表示します。",
|
||||
"swap-usage-label": "スワップ使用量",
|
||||
"use-monospace-font-description": "タイプライター体で翻訳します。",
|
||||
"use-monospace-font-label": "等幅フォント"
|
||||
},
|
||||
|
||||
@@ -209,6 +209,8 @@
|
||||
"network-traffic-label": "Trafîka torê",
|
||||
"storage-usage-description": "Agahiyên bikaranîna cîhê dîskê nîşan bide.",
|
||||
"storage-usage-label": "Bikaranîna hilanînê",
|
||||
"swap-usage-description": "Bikaranîna bîra swapê nîşan bide.",
|
||||
"swap-usage-label": "Bikaranîna Swapê",
|
||||
"use-monospace-font-description": "Bi kar tîne fonta monospace ji bo firehiya karakterê ya domdar.",
|
||||
"use-monospace-font-label": "Tîpa yek-firehî"
|
||||
},
|
||||
|
||||
@@ -209,6 +209,8 @@
|
||||
"network-traffic-label": "Netwerkverkeer",
|
||||
"storage-usage-description": "Toon informatie over schijfruimtegebruik.",
|
||||
"storage-usage-label": "Opslaggebruik",
|
||||
"swap-usage-description": "Toon swap geheugengebruik.",
|
||||
"swap-usage-label": "Swapgebruik",
|
||||
"use-monospace-font-description": "Gebruik een monospace lettertype voor een consistente tekenbreedte.",
|
||||
"use-monospace-font-label": "Lettertype met vaste breedte"
|
||||
},
|
||||
|
||||
@@ -209,6 +209,8 @@
|
||||
"network-traffic-label": "Ruch sieciowy",
|
||||
"storage-usage-description": "Pokaż informacje o użyciu miejsca na dysku.",
|
||||
"storage-usage-label": "Użycie dysku",
|
||||
"swap-usage-description": "Pokaż użycie pamięci wymiany.",
|
||||
"swap-usage-label": "Użycie pamięci wymiany",
|
||||
"use-monospace-font-description": "Użyj czcionki o stałej szerokości znaków dla zachowania spójnej szerokości znaków.",
|
||||
"use-monospace-font-label": "Czcionka o stałej szerokości znaków"
|
||||
},
|
||||
|
||||
@@ -209,6 +209,8 @@
|
||||
"network-traffic-label": "Tráfego de rede",
|
||||
"storage-usage-description": "Mostrar as informações de uso do espaço em disco.",
|
||||
"storage-usage-label": "Uso de armazenamento",
|
||||
"swap-usage-description": "Mostrar o uso da memória swap.",
|
||||
"swap-usage-label": "Utilização de swap",
|
||||
"use-monospace-font-description": "Use fonte monoespaçada para largura de caractere consistente.",
|
||||
"use-monospace-font-label": "Fonte monoespaçada"
|
||||
},
|
||||
|
||||
@@ -209,6 +209,8 @@
|
||||
"network-traffic-label": "Сетевой трафик",
|
||||
"storage-usage-description": "Показывать информацию об использовании дискового пространства.",
|
||||
"storage-usage-label": "Использование хранилища",
|
||||
"swap-usage-description": "Показать использование swap-памяти.",
|
||||
"swap-usage-label": "Использование swap",
|
||||
"use-monospace-font-description": "Используйте моноширинный шрифт для единообразной ширины символов.",
|
||||
"use-monospace-font-label": "Моноширинный шрифт"
|
||||
},
|
||||
|
||||
@@ -209,6 +209,8 @@
|
||||
"network-traffic-label": "Ağ trafiği",
|
||||
"storage-usage-description": "Disk alanı kullanım bilgilerini göster.",
|
||||
"storage-usage-label": "Depolama kullanımı",
|
||||
"swap-usage-description": "Takas belleği kullanımını göster.",
|
||||
"swap-usage-label": "Takas kullanımı",
|
||||
"use-monospace-font-description": "Tekdüze karakter genişliği için tek aralıklı yazı tipini kullanın.",
|
||||
"use-monospace-font-label": "Tek aralıklı yazı tipi"
|
||||
},
|
||||
|
||||
@@ -209,6 +209,8 @@
|
||||
"network-traffic-label": "Мережевий трафік",
|
||||
"storage-usage-description": "Показувати інформацію про використання дискового простору.",
|
||||
"storage-usage-label": "Використання сховища",
|
||||
"swap-usage-description": "Показати використання swap-пам'яті.",
|
||||
"swap-usage-label": "Використання swap",
|
||||
"use-monospace-font-description": "Використовуйте моноширинний шрифт для забезпечення сталої ширини символів.",
|
||||
"use-monospace-font-label": "Моноширинний шрифт"
|
||||
},
|
||||
|
||||
@@ -209,6 +209,8 @@
|
||||
"network-traffic-label": "网络流量",
|
||||
"storage-usage-description": "显示磁盘空间使用信息。",
|
||||
"storage-usage-label": "存储使用率",
|
||||
"swap-usage-description": "显示交换内存使用情况。",
|
||||
"swap-usage-label": "交换内存使用量",
|
||||
"use-monospace-font-description": "请使用等宽字体以保持字符宽度一致。",
|
||||
"use-monospace-font-label": "等宽字体"
|
||||
},
|
||||
@@ -679,10 +681,10 @@
|
||||
"volumes-output-volume-description": "系统全局音量级别。",
|
||||
"volumes-step-size-description": "调整音量变化的步长(滚轮、键盘快捷键)。",
|
||||
"volumes-step-size-label": "音量步长",
|
||||
"volumes-volume-overdrive-description": "允许将音量提高到100%以上。可能不被所有硬件支持。",
|
||||
"volumes-volume-overdrive-label": "允许音量过载",
|
||||
"volumes-volume-feedback-description": "调整音量时播放反馈音效",
|
||||
"volumes-volume-feedback-label": "播放音量反馈",
|
||||
"volumes-volume-feedback-description": "调整音量时播放反馈音效"
|
||||
"volumes-volume-overdrive-description": "允许将音量提高到100%以上。可能不被所有硬件支持。",
|
||||
"volumes-volume-overdrive-label": "允许音量过载"
|
||||
},
|
||||
"bar": {
|
||||
"appearance-background-opacity-description": "为状态栏设置背景不透明度。",
|
||||
|
||||
@@ -206,6 +206,8 @@
|
||||
"network-traffic-label": "網路流量",
|
||||
"storage-usage-description": "顯示磁碟空間的使用量",
|
||||
"storage-usage-label": "磁碟使用量",
|
||||
"swap-usage-description": "顯示交換記憶體使用量。",
|
||||
"swap-usage-label": "交換空間使用量",
|
||||
"use-monospace-font-description": "使用等寬字型可以達成一致的字元寬度",
|
||||
"use-monospace-font-label": "等寬字型"
|
||||
},
|
||||
|
||||
@@ -247,6 +247,8 @@
|
||||
"gpuCriticalThreshold": 90,
|
||||
"memWarningThreshold": 80,
|
||||
"memCriticalThreshold": 90,
|
||||
"swapWarningThreshold": 80,
|
||||
"swapCriticalThreshold": 90,
|
||||
"diskWarningThreshold": 80,
|
||||
"diskCriticalThreshold": 90,
|
||||
"cpuPollingInterval": 3000,
|
||||
@@ -254,7 +256,7 @@
|
||||
"gpuPollingInterval": 3000,
|
||||
"enableDgpuMonitoring": false,
|
||||
"memPollingInterval": 3000,
|
||||
"diskPollingInterval": 3000,
|
||||
"diskPollingInterval": 30000,
|
||||
"networkPollingInterval": 3000,
|
||||
"loadAvgPollingInterval": 3000,
|
||||
"useCustomColors": false,
|
||||
@@ -367,7 +369,8 @@
|
||||
"cavaFrameRate": 30,
|
||||
"visualizerType": "linear",
|
||||
"mprisBlacklist": [],
|
||||
"preferredPlayer": ""
|
||||
"preferredPlayer": "",
|
||||
"volumeFeedback": false
|
||||
},
|
||||
"brightness": {
|
||||
"brightnessStep": 5,
|
||||
|
||||
@@ -132,6 +132,7 @@
|
||||
"showLoadAverage": false,
|
||||
"showMemoryUsage": true,
|
||||
"showMemoryAsPercent": false,
|
||||
"showSwapUsage": false,
|
||||
"showNetworkStats": false,
|
||||
"showDiskUsage": false,
|
||||
"diskPath": "/"
|
||||
|
||||
@@ -456,6 +456,8 @@ Singleton {
|
||||
property int gpuCriticalThreshold: 90
|
||||
property int memWarningThreshold: 80
|
||||
property int memCriticalThreshold: 90
|
||||
property int swapWarningThreshold: 80
|
||||
property int swapCriticalThreshold: 90
|
||||
property int diskWarningThreshold: 80
|
||||
property int diskCriticalThreshold: 90
|
||||
property int cpuPollingInterval: 3000
|
||||
@@ -463,7 +465,7 @@ Singleton {
|
||||
property int gpuPollingInterval: 3000
|
||||
property bool enableDgpuMonitoring: false // Opt-in: reading dGPU sysfs/nvidia-smi wakes it from D3cold, draining battery
|
||||
property int memPollingInterval: 3000
|
||||
property int diskPollingInterval: 3000
|
||||
property int diskPollingInterval: 30000
|
||||
property int networkPollingInterval: 3000
|
||||
property int loadAvgPollingInterval: 3000
|
||||
property bool useCustomColors: false
|
||||
|
||||
@@ -43,6 +43,7 @@ Rectangle {
|
||||
readonly property bool showGpuTemp: (widgetSettings.showGpuTemp !== undefined) ? widgetSettings.showGpuTemp : widgetMetadata.showGpuTemp
|
||||
readonly property bool showMemoryUsage: (widgetSettings.showMemoryUsage !== undefined) ? widgetSettings.showMemoryUsage : widgetMetadata.showMemoryUsage
|
||||
readonly property bool showMemoryAsPercent: (widgetSettings.showMemoryAsPercent !== undefined) ? widgetSettings.showMemoryAsPercent : widgetMetadata.showMemoryAsPercent
|
||||
readonly property bool showSwapUsage: (widgetSettings.showSwapUsage !== undefined) ? widgetSettings.showSwapUsage : widgetMetadata.showSwapUsage
|
||||
readonly property bool showNetworkStats: (widgetSettings.showNetworkStats !== undefined) ? widgetSettings.showNetworkStats : widgetMetadata.showNetworkStats
|
||||
readonly property bool showDiskUsage: (widgetSettings.showDiskUsage !== undefined) ? widgetSettings.showDiskUsage : widgetMetadata.showDiskUsage
|
||||
readonly property bool showLoadAverage: (widgetSettings.showLoadAverage !== undefined) ? widgetSettings.showLoadAverage : widgetMetadata.showLoadAverage
|
||||
@@ -79,6 +80,11 @@ Rectangle {
|
||||
// Memory
|
||||
lines.push(`${I18n.tr("common.memory")}: ${Math.round(SystemStatService.memPercent)}% (${SystemStatService.formatMemoryGb(SystemStatService.memGb)})`);
|
||||
|
||||
// Swap (if available)
|
||||
if (SystemStatService.swapTotalGb > 0) {
|
||||
lines.push(`${I18n.tr("bar.system-monitor.swap-usage-label")}: ${Math.round(SystemStatService.swapPercent)}% (${SystemStatService.formatMemoryGb(SystemStatService.swapGb)})`);
|
||||
}
|
||||
|
||||
// Network
|
||||
lines.push(`${I18n.tr("system-monitor.download-speed")}: ${SystemStatService.formatSpeed(SystemStatService.rxSpeed)}`);
|
||||
lines.push(`${I18n.tr("system-monitor.upload-speed")}: ${SystemStatService.formatSpeed(SystemStatService.txSpeed)}`);
|
||||
@@ -105,6 +111,8 @@ Rectangle {
|
||||
readonly property bool gpuCritical: showGpuTemp && SystemStatService.gpuCritical
|
||||
readonly property bool memWarning: showMemoryUsage && SystemStatService.memWarning
|
||||
readonly property bool memCritical: showMemoryUsage && SystemStatService.memCritical
|
||||
readonly property bool swapWarning: showSwapUsage && SystemStatService.swapWarning
|
||||
readonly property bool swapCritical: showSwapUsage && SystemStatService.swapCritical
|
||||
readonly property bool diskWarning: showDiskUsage && SystemStatService.isDiskWarning(diskPath)
|
||||
readonly property bool diskCritical: showDiskUsage && SystemStatService.isDiskCritical(diskPath)
|
||||
|
||||
@@ -572,6 +580,74 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// Swap Usage Component
|
||||
Item {
|
||||
id: swapContainer
|
||||
implicitWidth: swapContent.implicitWidth
|
||||
implicitHeight: swapContent.implicitHeight
|
||||
Layout.preferredWidth: isVertical ? root.width : implicitWidth
|
||||
Layout.preferredHeight: compactMode ? implicitHeight : Style.capsuleHeight
|
||||
Layout.alignment: isVertical ? Qt.AlignHCenter : Qt.AlignVCenter
|
||||
visible: showSwapUsage && SystemStatService.swapTotalGb > 0
|
||||
|
||||
GridLayout {
|
||||
id: swapContent
|
||||
anchors.centerIn: parent
|
||||
flow: (isVertical && !compactMode) ? GridLayout.TopToBottom : GridLayout.LeftToRight
|
||||
rows: (isVertical && !compactMode) ? 2 : 1
|
||||
columns: (isVertical && !compactMode) ? 1 : 2
|
||||
rowSpacing: Style.marginXXS
|
||||
columnSpacing: compactMode ? 3 : Style.marginXS
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: iconSize
|
||||
Layout.preferredHeight: compactMode ? iconSize : Style.capsuleHeight
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
Layout.row: (isVertical && !compactMode) ? 1 : 0
|
||||
Layout.column: 0
|
||||
|
||||
NIcon {
|
||||
icon: "exchange"
|
||||
pointSize: iconSize
|
||||
applyUiScale: false
|
||||
x: Style.pixelAlignCenter(parent.width, width)
|
||||
y: Style.pixelAlignCenter(parent.height, contentHeight)
|
||||
color: (swapWarning || swapCritical) ? SystemStatService.swapColor : Color.mOnSurface
|
||||
}
|
||||
}
|
||||
|
||||
// Text mode
|
||||
NText {
|
||||
visible: !compactMode
|
||||
text: `${Math.round(SystemStatService.swapPercent)}%`
|
||||
family: fontFamily
|
||||
pointSize: Style.barFontSize
|
||||
applyUiScale: false
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: (swapWarning || swapCritical) ? SystemStatService.swapColor : textColor
|
||||
Layout.row: isVertical ? 0 : 0
|
||||
Layout.column: isVertical ? 0 : 1
|
||||
}
|
||||
|
||||
// Compact mode
|
||||
Loader {
|
||||
active: compactMode
|
||||
visible: compactMode
|
||||
sourceComponent: miniGaugeComponent
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
Layout.row: 0
|
||||
Layout.column: 1
|
||||
|
||||
onLoaded: {
|
||||
item.ratio = Qt.binding(() => SystemStatService.swapPercent / 100);
|
||||
item.statColor = Qt.binding(() => SystemStatService.swapColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Network Download Speed Component
|
||||
Item {
|
||||
implicitWidth: downloadContent.implicitWidth
|
||||
|
||||
@@ -23,6 +23,7 @@ ColumnLayout {
|
||||
property bool valueShowLoadAverage: widgetData.showLoadAverage !== undefined ? widgetData.showLoadAverage : widgetMetadata.showLoadAverage
|
||||
property bool valueShowMemoryUsage: widgetData.showMemoryUsage !== undefined ? widgetData.showMemoryUsage : widgetMetadata.showMemoryUsage
|
||||
property bool valueShowMemoryAsPercent: widgetData.showMemoryAsPercent !== undefined ? widgetData.showMemoryAsPercent : widgetMetadata.showMemoryAsPercent
|
||||
property bool valueShowSwapUsage: widgetData.showSwapUsage !== undefined ? widgetData.showSwapUsage : widgetMetadata.showSwapUsage
|
||||
property bool valueShowNetworkStats: widgetData.showNetworkStats !== undefined ? widgetData.showNetworkStats : widgetMetadata.showNetworkStats
|
||||
property bool valueShowDiskUsage: widgetData.showDiskUsage !== undefined ? widgetData.showDiskUsage : widgetMetadata.showDiskUsage
|
||||
property string valueDiskPath: widgetData.diskPath !== undefined ? widgetData.diskPath : widgetMetadata.diskPath
|
||||
@@ -38,6 +39,7 @@ ColumnLayout {
|
||||
settings.showLoadAverage = valueShowLoadAverage;
|
||||
settings.showMemoryUsage = valueShowMemoryUsage;
|
||||
settings.showMemoryAsPercent = valueShowMemoryAsPercent;
|
||||
settings.showSwapUsage = valueShowSwapUsage;
|
||||
settings.showNetworkStats = valueShowNetworkStats;
|
||||
settings.showDiskUsage = valueShowDiskUsage;
|
||||
settings.diskPath = valueDiskPath;
|
||||
@@ -127,6 +129,15 @@ ColumnLayout {
|
||||
visible: valueShowMemoryUsage
|
||||
}
|
||||
|
||||
NToggle {
|
||||
id: showSwapUsage
|
||||
Layout.fillWidth: true
|
||||
label: I18n.tr("bar.system-monitor.swap-usage-label")
|
||||
description: I18n.tr("bar.system-monitor.swap-usage-description")
|
||||
checked: valueShowSwapUsage
|
||||
onToggled: checked => valueShowSwapUsage = checked
|
||||
}
|
||||
|
||||
NToggle {
|
||||
id: showNetworkStats
|
||||
Layout.fillWidth: true
|
||||
|
||||
@@ -137,8 +137,8 @@ ColumnLayout {
|
||||
}
|
||||
|
||||
NSpinBox {
|
||||
from: 250
|
||||
to: 10000
|
||||
from: 1000
|
||||
to: 60000
|
||||
stepSize: 250
|
||||
value: Settings.data.systemMonitor.diskPollingInterval
|
||||
defaultValue: Settings.getDefaultValue("systemMonitor.diskPollingInterval")
|
||||
|
||||
@@ -178,6 +178,39 @@ ColumnLayout {
|
||||
onValueChanged: Settings.data.systemMonitor.memCriticalThreshold = value
|
||||
}
|
||||
|
||||
// Swap Usage
|
||||
NText {
|
||||
text: I18n.tr("bar.system-monitor.swap-usage-label")
|
||||
pointSize: Style.fontSizeL
|
||||
}
|
||||
|
||||
NSpinBox {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
from: 0
|
||||
to: 100
|
||||
stepSize: 5
|
||||
value: Settings.data.systemMonitor.swapWarningThreshold
|
||||
defaultValue: Settings.getDefaultValue("systemMonitor.swapWarningThreshold")
|
||||
suffix: "%"
|
||||
onValueChanged: {
|
||||
Settings.data.systemMonitor.swapWarningThreshold = value;
|
||||
if (Settings.data.systemMonitor.swapCriticalThreshold < value) {
|
||||
Settings.data.systemMonitor.swapCriticalThreshold = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NSpinBox {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
from: Settings.data.systemMonitor.swapWarningThreshold
|
||||
to: 100
|
||||
stepSize: 5
|
||||
value: Settings.data.systemMonitor.swapCriticalThreshold
|
||||
defaultValue: Settings.getDefaultValue("systemMonitor.swapCriticalThreshold")
|
||||
suffix: "%"
|
||||
onValueChanged: Settings.data.systemMonitor.swapCriticalThreshold = value
|
||||
}
|
||||
|
||||
// Disk Usage
|
||||
NText {
|
||||
text: I18n.tr("panels.system-monitor.disk-section-label")
|
||||
|
||||
@@ -150,6 +150,22 @@ SmartPanel {
|
||||
}
|
||||
}
|
||||
|
||||
// Swap Usage (only visible if swap is enabled)
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: cpuGauge.implicitHeight
|
||||
visible: SystemStatService.swapTotalGb > 0
|
||||
|
||||
NCircleStat {
|
||||
anchors.centerIn: parent
|
||||
ratio: SystemStatService.swapPercent / 100
|
||||
icon: "exchange"
|
||||
suffix: "%"
|
||||
fillColor: SystemStatService.swapColor
|
||||
tooltipText: I18n.tr("bar.system-monitor.swap-usage-label") + `: ${Math.round(SystemStatService.swapPercent)}%`
|
||||
}
|
||||
}
|
||||
|
||||
// Disk Usage
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
@@ -180,7 +196,14 @@ SmartPanel {
|
||||
spacing: Style.marginS
|
||||
|
||||
// Number of visible gauges in top row
|
||||
readonly property int topRowGaugeCount: SystemStatService.gpuAvailable ? 5 : 4
|
||||
readonly property int topRowGaugeCount: {
|
||||
let count = 4; // CPU, CPU Temp, Memory, Disk
|
||||
if (SystemStatService.gpuAvailable)
|
||||
count++;
|
||||
if (SystemStatService.swapTotalGb > 0)
|
||||
count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
// Download gauge with speed below (same width as top row items)
|
||||
Item {
|
||||
@@ -302,6 +325,33 @@ SmartPanel {
|
||||
}
|
||||
}
|
||||
|
||||
// Swap details (only visible if swap is enabled)
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginS
|
||||
visible: SystemStatService.swapTotalGb > 0
|
||||
|
||||
NIcon {
|
||||
icon: "exchange"
|
||||
pointSize: Style.fontSizeM
|
||||
color: Color.mOnSurfaceVariant
|
||||
}
|
||||
|
||||
NText {
|
||||
text: I18n.tr("bar.system-monitor.swap-usage-label") + ":"
|
||||
pointSize: Style.fontSizeXS
|
||||
color: Color.mOnSurfaceVariant
|
||||
}
|
||||
|
||||
NText {
|
||||
text: `${SystemStatService.formatMemoryGb(SystemStatService.swapGb)} / ${SystemStatService.formatMemoryGb(SystemStatService.swapTotalGb)}`
|
||||
pointSize: Style.fontSizeXS
|
||||
color: Color.mOnSurface
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignRight
|
||||
}
|
||||
}
|
||||
|
||||
// Disk details
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
@@ -25,6 +25,9 @@ Singleton {
|
||||
property string gpuType: "" // "amd", "intel", "nvidia"
|
||||
property real memGb: 0
|
||||
property real memPercent: 0
|
||||
property real swapGb: 0
|
||||
property real swapPercent: 0
|
||||
property real swapTotalGb: 0
|
||||
property var diskPercents: ({})
|
||||
property var diskUsedGb: ({}) // Used space in GB per mount point
|
||||
property var diskSizeGb: ({}) // Total size in GB per mount point
|
||||
@@ -64,6 +67,8 @@ Singleton {
|
||||
readonly property int gpuCriticalThreshold: Settings.data.systemMonitor.gpuCriticalThreshold
|
||||
readonly property int memWarningThreshold: Settings.data.systemMonitor.memWarningThreshold
|
||||
readonly property int memCriticalThreshold: Settings.data.systemMonitor.memCriticalThreshold
|
||||
readonly property int swapWarningThreshold: Settings.data.systemMonitor.swapWarningThreshold
|
||||
readonly property int swapCriticalThreshold: Settings.data.systemMonitor.swapCriticalThreshold
|
||||
readonly property int diskWarningThreshold: Settings.data.systemMonitor.diskWarningThreshold
|
||||
readonly property int diskCriticalThreshold: Settings.data.systemMonitor.diskCriticalThreshold
|
||||
|
||||
@@ -76,6 +81,8 @@ Singleton {
|
||||
readonly property bool gpuCritical: gpuAvailable && gpuTemp >= gpuCriticalThreshold
|
||||
readonly property bool memWarning: memPercent >= memWarningThreshold
|
||||
readonly property bool memCritical: memPercent >= memCriticalThreshold
|
||||
readonly property bool swapWarning: swapPercent >= swapWarningThreshold
|
||||
readonly property bool swapCritical: swapPercent >= swapCriticalThreshold
|
||||
|
||||
// Helper functions for disk (disk path is dynamic)
|
||||
function isDiskWarning(diskPath) {
|
||||
@@ -91,6 +98,7 @@ Singleton {
|
||||
readonly property color tempColor: tempCritical ? criticalColor : (tempWarning ? warningColor : Color.mPrimary)
|
||||
readonly property color gpuColor: gpuCritical ? criticalColor : (gpuWarning ? warningColor : Color.mPrimary)
|
||||
readonly property color memColor: memCritical ? criticalColor : (memWarning ? warningColor : Color.mPrimary)
|
||||
readonly property color swapColor: swapCritical ? criticalColor : (swapWarning ? warningColor : Color.mPrimary)
|
||||
|
||||
function getDiskColor(diskPath) {
|
||||
return isDiskCritical(diskPath) ? criticalColor : (isDiskWarning(diskPath) ? warningColor : Color.mPrimary);
|
||||
@@ -702,12 +710,18 @@ Singleton {
|
||||
const lines = text.split('\n');
|
||||
let memTotal = 0;
|
||||
let memAvailable = 0;
|
||||
let swapTotal = 0;
|
||||
let swapFree = 0;
|
||||
|
||||
for (const line of lines) {
|
||||
if (line.startsWith('MemTotal:')) {
|
||||
memTotal = parseInt(line.split(/\s+/)[1]) || 0;
|
||||
} else if (line.startsWith('MemAvailable:')) {
|
||||
memAvailable = parseInt(line.split(/\s+/)[1]) || 0;
|
||||
} else if (line.startsWith('SwapTotal:')) {
|
||||
swapTotal = parseInt(line.split(/\s+/)[1]) || 0;
|
||||
} else if (line.startsWith('SwapFree:')) {
|
||||
swapFree = parseInt(line.split(/\s+/)[1]) || 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -720,6 +734,17 @@ Singleton {
|
||||
root.memGb = (usageKb / 1048576).toFixed(1); // 1024*1024 = 1048576
|
||||
root.memPercent = Math.round((usageKb / memTotal) * 100);
|
||||
}
|
||||
|
||||
// Swap usage
|
||||
root.swapTotalGb = (swapTotal / 1048576).toFixed(1);
|
||||
if (swapTotal > 0) {
|
||||
const swapUsedKb = swapTotal - swapFree;
|
||||
root.swapGb = (swapUsedKb / 1048576).toFixed(1);
|
||||
root.swapPercent = Math.round((swapUsedKb / swapTotal) * 100);
|
||||
} else {
|
||||
root.swapGb = 0;
|
||||
root.swapPercent = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
|
||||
@@ -204,6 +204,7 @@ Singleton {
|
||||
"showLoadAverage": false,
|
||||
"showMemoryUsage": true,
|
||||
"showMemoryAsPercent": false,
|
||||
"showSwapUsage": false,
|
||||
"showNetworkStats": false,
|
||||
"showDiskUsage": false,
|
||||
"diskPath": "/"
|
||||
|
||||
Reference in New Issue
Block a user