add systemd and machinectl bar modules with applets

This commit is contained in:
Damocles 2026-05-01 18:43:35 +02:00
parent 7ab784e101
commit 8ab3fc5f6b
12 changed files with 1117 additions and 1 deletions

View file

@ -0,0 +1,55 @@
import QtQuick
import Quickshell
import "." as M
import "../services" as S
import "../applets" as C
M.BarModule {
id: root
active: S.Modules.systemd.enable
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
}
}
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 S.Theme.base0A;
return S.Theme.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
}
}