add systemd and machinectl bar modules with applets
This commit is contained in:
parent
7ab784e101
commit
8ab3fc5f6b
12 changed files with 1117 additions and 1 deletions
|
|
@ -185,6 +185,8 @@ PanelWindow {
|
|||
M.TemperatureModule {}
|
||||
M.WeatherModule {}
|
||||
M.DiskModule {}
|
||||
M.SystemdModule {}
|
||||
M.MachinectlModule {}
|
||||
}
|
||||
|
||||
// Power + Dock
|
||||
|
|
|
|||
44
shell/modules/MachinectlModule.qml
Normal file
44
shell/modules/MachinectlModule.qml
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import QtQuick
|
||||
import Quickshell
|
||||
import "." as M
|
||||
import "../services" as S
|
||||
import "../applets" as C
|
||||
|
||||
M.BarModule {
|
||||
id: root
|
||||
active: S.Modules.machinectl.enable
|
||||
tooltip: {
|
||||
const n = S.MachinectlService.machines.length;
|
||||
return n === 0 ? "no containers" : n + " container" + (n === 1 ? "" : "s");
|
||||
}
|
||||
panelNamespace: "nova-machinectl"
|
||||
panelContentWidth: 320
|
||||
panelComponent: Component {
|
||||
C.MachinectlApplet {
|
||||
width: parent.width
|
||||
accentColor: root.accentColor
|
||||
active: root._showPanel
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: S.MachinectlService
|
||||
function onMachineReady() {
|
||||
root.keepPanelOpen(300);
|
||||
}
|
||||
}
|
||||
|
||||
readonly property color _stateColor: S.MachinectlService.anyUnhealthy ? S.Theme.base0A : root.accentColor
|
||||
|
||||
M.BarIcon {
|
||||
icon: ""
|
||||
color: root._stateColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
M.BarLabel {
|
||||
label: S.MachinectlService.machines.length.toString()
|
||||
minText: "9"
|
||||
color: root._stateColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
55
shell/modules/SystemdModule.qml
Normal file
55
shell/modules/SystemdModule.qml
Normal 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
|
||||
}
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@ DockModule 1.0 DockModule.qml
|
|||
GpuModule 1.0 GpuModule.qml
|
||||
HoverPanel 1.0 HoverPanel.qml
|
||||
IdleInhibitorModule 1.0 IdleInhibitorModule.qml
|
||||
MachinectlModule 1.0 MachinectlModule.qml
|
||||
MemoryModule 1.0 MemoryModule.qml
|
||||
MprisModule 1.0 MprisModule.qml
|
||||
NetworkModule 1.0 NetworkModule.qml
|
||||
|
|
@ -31,6 +32,7 @@ ProcessList 1.0 ProcessList.qml
|
|||
PulseAnimation 1.0 PulseAnimation.qml
|
||||
ScreenCapture 1.0 ScreenCapture.qml
|
||||
ScreenCorners 1.0 ScreenCorners.qml
|
||||
SystemdModule 1.0 SystemdModule.qml
|
||||
TemperatureModule 1.0 TemperatureModule.qml
|
||||
ThemedIcon 1.0 ThemedIcon.qml
|
||||
Tooltip 1.0 Tooltip.qml
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue