44 lines
1.2 KiB
QML
44 lines
1.2 KiB
QML
import QtQuick
|
|
import Quickshell
|
|
import "." as M
|
|
import "../services" as S
|
|
import "../applets" as C
|
|
import NovaStats as NS
|
|
|
|
M.BarModule {
|
|
id: root
|
|
active: NS.ModulesService.diskEnable
|
|
spacing: Math.max(1, NS.ThemeService.moduleSpacing - 2)
|
|
tooltip: "Disk: " + _rootPct + "% used"
|
|
panelNamespace: "nova-disk"
|
|
panelContentWidth: 260
|
|
panelComponent: Component {
|
|
C.DiskApplet {
|
|
width: parent.width
|
|
mounts: root._mounts
|
|
accentColor: root.accentColor
|
|
}
|
|
}
|
|
|
|
property var _mounts: S.SystemStats.diskMounts
|
|
property int _rootPct: S.SystemStats.diskRootPct
|
|
readonly property int _warnThreshold: NS.ModulesService.diskWarnThreshold ?? 85
|
|
readonly property bool _anyWarn: {
|
|
for (const m of _mounts)
|
|
if (m.pct >= _warnThreshold)
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
M.BarIcon {
|
|
icon: "\uF0C9"
|
|
color: root._anyWarn ? NS.ThemeService.base09 : root.accentColor
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
}
|
|
M.BarLabel {
|
|
label: root._rootPct + "%"
|
|
minText: "100%"
|
|
color: root._anyWarn ? NS.ThemeService.base09 : root.accentColor
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
}
|
|
}
|