disk module: warn color when any mount exceeds threshold (default 85%)
This commit is contained in:
parent
ad24015487
commit
621ec3bfc5
2 changed files with 11 additions and 1 deletions
|
|
@ -11,6 +11,13 @@ M.BarSection {
|
||||||
|
|
||||||
property var _mounts: S.SystemStats.diskMounts
|
property var _mounts: S.SystemStats.diskMounts
|
||||||
property int _rootPct: S.SystemStats.diskRootPct
|
property int _rootPct: S.SystemStats.diskRootPct
|
||||||
|
readonly property int _warnThreshold: S.Modules.disk.warnThreshold ?? 85
|
||||||
|
readonly property bool _anyWarn: {
|
||||||
|
for (const m of _mounts)
|
||||||
|
if (m.pct >= _warnThreshold)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
property bool _pinned: false
|
property bool _pinned: false
|
||||||
readonly property bool _anyHover: root._hovered || hoverPanel.panelHovered
|
readonly property bool _anyHover: root._hovered || hoverPanel.panelHovered
|
||||||
|
|
@ -31,6 +38,7 @@ M.BarSection {
|
||||||
|
|
||||||
M.BarIcon {
|
M.BarIcon {
|
||||||
icon: "\uF0C9"
|
icon: "\uF0C9"
|
||||||
|
color: root._anyWarn ? S.Theme.base09 : root.accentColor
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
TapHandler {
|
TapHandler {
|
||||||
onTapped: root._pinned = !root._pinned
|
onTapped: root._pinned = !root._pinned
|
||||||
|
|
@ -39,6 +47,7 @@ M.BarSection {
|
||||||
M.BarLabel {
|
M.BarLabel {
|
||||||
label: root._rootPct + "%"
|
label: root._rootPct + "%"
|
||||||
minText: "100%"
|
minText: "100%"
|
||||||
|
color: root._anyWarn ? S.Theme.base09 : root.accentColor
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
TapHandler {
|
TapHandler {
|
||||||
onTapped: root._pinned = !root._pinned
|
onTapped: root._pinned = !root._pinned
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,8 @@ QtObject {
|
||||||
})
|
})
|
||||||
property var disk: ({
|
property var disk: ({
|
||||||
enable: true,
|
enable: true,
|
||||||
interval: 30000
|
interval: 30000,
|
||||||
|
warnThreshold: 85
|
||||||
})
|
})
|
||||||
property var battery: ({
|
property var battery: ({
|
||||||
enable: true,
|
enable: true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue