k8s-widget: add KubernetesPill to bar
This commit is contained in:
@@ -124,6 +124,8 @@ Scope {
|
||||
]
|
||||
}
|
||||
|
||||
BarComponents.KubernetesPill { id: kubernetesBtn }
|
||||
|
||||
BarComponents.SystemPill { id: systemBtn }
|
||||
}
|
||||
}
|
||||
|
||||
50
dot_config/quickshell/bar/KubernetesPill.qml
Normal file
50
dot_config/quickshell/bar/KubernetesPill.qml
Normal 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
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user