quickshell: speed up k8s refresh while the popout is open

While the popout is open, poll both status and metrics at a fast cadence
(kubeRefreshOpenMs, 3s) instead of 2min/15s, and refresh immediately when
it opens — so opening the pill shows fresh data and updates live. Status
reverts to the slow 2min pill cadence once closed.
This commit is contained in:
2026-06-01 14:49:22 +02:00
parent 54e12efcae
commit 4f13f5c7c0
2 changed files with 19 additions and 9 deletions
+2 -2
View File
@@ -56,8 +56,8 @@ Singleton {
// Kubernetes
readonly property bool kubeEnabled: true
readonly property string kubeNamespace: "tenant-5"
readonly property int kubeStatusRefreshMs: 120000
readonly property int kubeMetricsRefreshMs: 15000
readonly property int kubeStatusRefreshMs: 120000 // pill cadence while popout closed
readonly property int kubeRefreshOpenMs: 3000 // fast status+metrics cadence while popout open
// Idle daemon
readonly property string idleProcess: "hypridle"
+17 -7
View File
@@ -78,21 +78,31 @@ Singleton {
onTriggered: root.lastUpdatedSecs++
}
// Status poller
// Force an immediate refresh (status always; metrics only while the popout is
// open, where they're shown). Called on pill click and on popout open.
function refresh() {
statusProc.running = false; statusProc.running = true;
if (PopoutState.active === "kubernetes") {
metricsProc.running = false; metricsProc.running = true;
}
}
readonly property bool popoutOpen: PopoutState.active === "kubernetes"
onPopoutOpenChanged: if (popoutOpen) refresh()
// Status poller — slow while the popout is closed (just the pill), fast while open.
Timer {
interval: Config.kubeStatusRefreshMs
interval: root.popoutOpen ? Config.kubeRefreshOpenMs : Config.kubeStatusRefreshMs
running: Config.kubeEnabled
repeat: true
onTriggered: statusProc.running = true
}
// Metrics poller — only while the popout is open (metrics are popout-only).
// triggeredOnStart fetches immediately when the popout opens.
// Metrics poller — only while the popout is open, at the fast cadence.
Timer {
interval: Config.kubeMetricsRefreshMs
running: Config.kubeEnabled && PopoutState.active === "kubernetes"
interval: Config.kubeRefreshOpenMs
running: Config.kubeEnabled && root.popoutOpen
repeat: true
triggeredOnStart: true
onTriggered: metricsProc.running = true
}