59 lines
1.6 KiB
QML
59 lines
1.6 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
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.systemdEnable
|
|
tooltip: {
|
|
const sys = S.SystemdService.systemState;
|
|
const fc = S.SystemdService.totalFailedCount;
|
|
return "systemd: " + sys + (fc > 0 ? " (" + fc + " failed)" : "");
|
|
}
|
|
panelNamespace: "nova-systemd"
|
|
panelContentWidth: 300
|
|
panelComponent: Component {
|
|
C.SystemdApplet {
|
|
width: parent.width
|
|
accentColor: root.accentColor
|
|
active: root._showPanel
|
|
onContentResized: root.keepPanelOpen(300)
|
|
}
|
|
}
|
|
|
|
Connections {
|
|
target: S.SystemdService
|
|
function onSystemUnitsChanged() {
|
|
root.keepPanelOpen(300);
|
|
}
|
|
function onUserUnitsChanged() {
|
|
root.keepPanelOpen(300);
|
|
}
|
|
}
|
|
|
|
readonly property color _stateColor: {
|
|
const st = S.SystemdService.systemState;
|
|
if (st === "running")
|
|
return root.accentColor;
|
|
if (st === "degraded")
|
|
return NS.ThemeService.base0A;
|
|
return NS.ThemeService.base08;
|
|
}
|
|
|
|
M.BarIcon {
|
|
icon: ""
|
|
color: root._stateColor
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
}
|
|
M.BarLabel {
|
|
label: S.SystemdService.totalFailedCount > 0 ? S.SystemdService.totalFailedCount + " failed" : S.SystemdService.systemState
|
|
minText: "degraded"
|
|
color: root._stateColor
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
}
|
|
}
|