k8s-widget: add KubernetesPill to bar

This commit is contained in:
2026-04-22 01:40:31 +02:00
parent 8b5e5e392d
commit 222e01c562
2 changed files with 52 additions and 0 deletions

View File

@@ -124,6 +124,8 @@ Scope {
]
}
BarComponents.KubernetesPill { id: kubernetesBtn }
BarComponents.SystemPill { id: systemBtn }
}
}

View File

@@ -0,0 +1,50 @@
import Quickshell
import QtQuick
import QtQuick.Layouts
import "../shared" as Shared
BarPill {
groupName: "kubernetes"
accentColor: {
let s = Shared.Kubernetes.status;
if (s === "ok") return Shared.Theme.green;
if (s === "degraded") return Shared.Theme.yellow;
if (s === "error") return Shared.Theme.red;
if (s === "stale") return Shared.Theme.overlay0;
return Shared.Theme.blue;
}
content: [
Text {
Layout.alignment: Qt.AlignHCenter
text: "\u{f03be}"
color: {
let s = Shared.Kubernetes.status;
if (s === "ok") return Shared.Theme.green;
if (s === "degraded") return Shared.Theme.yellow;
if (s === "error") return Shared.Theme.red;
if (s === "stale") return Shared.Theme.overlay0;
return Shared.Theme.blue;
}
font.pixelSize: Shared.Theme.fontLarge
font.family: Shared.Theme.iconFont
},
Text {
Layout.alignment: Qt.AlignHCenter
text: Shared.Kubernetes.status === "loading"
? "…"
: Shared.Kubernetes.readyCount + "/" + Shared.Kubernetes.totalCount
color: {
let s = Shared.Kubernetes.status;
if (s === "ok") return Shared.Theme.green;
if (s === "degraded") return Shared.Theme.yellow;
if (s === "error") return Shared.Theme.red;
if (s === "stale") return Shared.Theme.overlay0;
return Shared.Theme.blue;
}
font.pixelSize: Shared.Theme.fontSmall
font.family: Shared.Theme.fontFamily
font.bold: true
}
]
}