mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
BarSysMon: you can now select which disk mount point to monitor storage.
This commit is contained in:
@@ -40,6 +40,7 @@ Rectangle {
|
||||
readonly property bool showMemoryAsPercent: (widgetSettings.showMemoryAsPercent !== undefined) ? widgetSettings.showMemoryAsPercent : widgetMetadata.showMemoryAsPercent
|
||||
readonly property bool showNetworkStats: (widgetSettings.showNetworkStats !== undefined) ? widgetSettings.showNetworkStats : widgetMetadata.showNetworkStats
|
||||
readonly property bool showDiskUsage: (widgetSettings.showDiskUsage !== undefined) ? widgetSettings.showDiskUsage : widgetMetadata.showDiskUsage
|
||||
readonly property string diskPath: (widgetSettings.diskPath !== undefined) ? widgetSettings.diskPath : widgetMetadata.diskPath
|
||||
|
||||
readonly property real iconSize: textSize * 1.4
|
||||
readonly property real textSize: {
|
||||
@@ -77,8 +78,8 @@ Rectangle {
|
||||
readonly property bool tempCritical: showCpuTemp && SystemStatService.cpuTemp > tempCriticalThreshold
|
||||
readonly property bool memWarning: showMemoryUsage && SystemStatService.memPercent > memWarningThreshold
|
||||
readonly property bool memCritical: showMemoryUsage && SystemStatService.memPercent > memCriticalThreshold
|
||||
readonly property bool diskWarning: showDiskUsage && SystemStatService.diskPercents["/"] > diskWarningThreshold
|
||||
readonly property bool diskCritical: showDiskUsage && SystemStatService.diskPercents["/"] > diskCriticalThreshold
|
||||
readonly property bool diskWarning: showDiskUsage && SystemStatService.diskPercents[diskPath] > diskWarningThreshold
|
||||
readonly property bool diskCritical: showDiskUsage && SystemStatService.diskPercents[diskPath] > diskCriticalThreshold
|
||||
|
||||
TextMetrics {
|
||||
id: percentMetrics
|
||||
@@ -501,7 +502,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
NText {
|
||||
text: `${SystemStatService.diskPercents["/"]}%`
|
||||
text: SystemStatService.diskPercents[diskPath] ? `${SystemStatService.diskPercents[diskPath]}%` : "n/a"
|
||||
family: Settings.data.ui.fontFixed
|
||||
pointSize: textSize
|
||||
applyUiScale: false
|
||||
|
||||
@@ -2,6 +2,7 @@ import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import qs.Commons
|
||||
import qs.Services.System
|
||||
import qs.Widgets
|
||||
|
||||
ColumnLayout {
|
||||
@@ -20,6 +21,7 @@ ColumnLayout {
|
||||
property bool valueShowMemoryAsPercent: widgetData.showMemoryAsPercent !== undefined ? widgetData.showMemoryAsPercent : widgetMetadata.showMemoryAsPercent
|
||||
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
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {});
|
||||
@@ -30,6 +32,7 @@ ColumnLayout {
|
||||
settings.showMemoryAsPercent = valueShowMemoryAsPercent;
|
||||
settings.showNetworkStats = valueShowNetworkStats;
|
||||
settings.showDiskUsage = valueShowDiskUsage;
|
||||
settings.diskPath = valueDiskPath;
|
||||
|
||||
return settings;
|
||||
}
|
||||
@@ -96,4 +99,21 @@ ColumnLayout {
|
||||
checked: valueShowDiskUsage
|
||||
onToggled: checked => valueShowDiskUsage = checked
|
||||
}
|
||||
|
||||
NComboBox {
|
||||
id: diskPathComboBox
|
||||
Layout.fillWidth: true
|
||||
label: I18n.tr("bar.widget-settings.system-monitor.disk-path.label")
|
||||
description: I18n.tr("bar.widget-settings.system-monitor.disk-path.description")
|
||||
visible: valueShowDiskUsage
|
||||
model: {
|
||||
const paths = Object.keys(SystemStatService.diskPercents).sort();
|
||||
return paths.map(path => ({
|
||||
key: path,
|
||||
name: path
|
||||
}));
|
||||
}
|
||||
currentKey: valueDiskPath
|
||||
onSelected: key => valueDiskPath = key
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user