From 4f13f5c7c0c42ec4ef143b585c84d53804ffb026 Mon Sep 17 00:00:00 2001 From: "s0wlz (Matthias Puchstein)" Date: Mon, 1 Jun 2026 14:49:22 +0200 Subject: [PATCH] quickshell: speed up k8s refresh while the popout is open MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- dot_config/quickshell/shared/Config.qml.tmpl | 4 ++-- dot_config/quickshell/shared/Kubernetes.qml | 24 ++++++++++++++------ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/dot_config/quickshell/shared/Config.qml.tmpl b/dot_config/quickshell/shared/Config.qml.tmpl index 2dafaca..f471841 100644 --- a/dot_config/quickshell/shared/Config.qml.tmpl +++ b/dot_config/quickshell/shared/Config.qml.tmpl @@ -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" diff --git a/dot_config/quickshell/shared/Kubernetes.qml b/dot_config/quickshell/shared/Kubernetes.qml index 15ac9c4..0b00dc2 100644 --- a/dot_config/quickshell/shared/Kubernetes.qml +++ b/dot_config/quickshell/shared/Kubernetes.qml @@ -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 }