merge systemd + machinectl into one module/applet (step 1)

This commit is contained in:
Damocles 2026-05-07 17:42:10 +02:00
commit 6fc7e8bc8a
16 changed files with 261 additions and 1029 deletions

View file

@ -1,7 +1,6 @@
pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import "." as M
import "../services" as S
import "../applets" as C
@ -11,12 +10,11 @@ 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)" : "");
const fc = S.SystemdService.failedCount;
return fc === 0 ? "systemd: ok" : "systemd: " + fc + " failed";
}
panelNamespace: "nova-systemd"
panelContentWidth: 300
panelContentWidth: 320
panelComponent: Component {
C.SystemdApplet {
width: parent.width
@ -28,22 +26,12 @@ M.BarModule {
Connections {
target: S.SystemdService
function onSystemUnitsChanged() {
root.keepPanelOpen(300);
}
function onUserUnitsChanged() {
function onFailedUnitsChanged() {
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;
}
readonly property color _stateColor: S.SystemdService.failedCount > 0 ? NS.ThemeService.base0A : root.accentColor
M.BarIcon {
icon: ""
@ -51,8 +39,8 @@ M.BarModule {
anchors.verticalCenter: parent.verticalCenter
}
M.BarLabel {
label: S.SystemdService.totalFailedCount > 0 ? S.SystemdService.totalFailedCount + " failed" : S.SystemdService.systemState
minText: "degraded"
label: S.SystemdService.failedCount > 0 ? S.SystemdService.failedCount + " failed" : "ok"
minText: "0 failed"
color: root._stateColor
anchors.verticalCenter: parent.verticalCenter
}