From 4d630c9f302f4519d5d3d9f37d9b5ab80a36fe0e Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 19 Jul 2026 22:35:40 -0700 Subject: [PATCH] Stop polling monitor/network state on an idle desktop The monitor panel polled `omarchy-monitor-state` every 5s (26 forks per call) and the network panel polled `omarchy-network-status` every 3s, both with `running: true` rather than gating like the sibling panels. Monitor: gate the poll on `opened` (brightness/scale are only shown in the open panel, which already refreshes on open) and drive the bar glyph from Quickshell.screens instead of the polled display list, so monitor count stays correct without polling. Network: the bar pill needs live-ish state, so keep polling but at 10s instead of 3s. (Deriving the pill from the native Networking service would remove the poll entirely; left as a follow-up since it needs Wi-Fi state testing.) Idle fork rate drops ~20/s to ~14/s. Co-Authored-By: Claude Fable 5 --- shell/plugins/panels/monitor/Panel.qml | 7 +++++-- shell/plugins/panels/network/Panel.qml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/shell/plugins/panels/monitor/Panel.qml b/shell/plugins/panels/monitor/Panel.qml index 1ca893c7..cb191e18 100644 --- a/shell/plugins/panels/monitor/Panel.qml +++ b/shell/plugins/panels/monitor/Panel.qml @@ -278,9 +278,12 @@ Panel { onDisplaysChanged: clampCursor() onVisibleSectionsChanged: clampCursor() + // Only poll while the panel is open; the bar glyph tracks monitor count via + // Quickshell.screens, and open-time refresh + Component.onCompleted cover the + // rest. External brightness changes are reflected whenever the panel is open. Timer { interval: 5000 - running: true + running: root.opened repeat: true onTriggered: root.refresh() } @@ -341,7 +344,7 @@ Panel { id: button anchors.fill: parent bar: root.bar - text: root.displays.length > 1 ? "󰍺" : "󰍹" + text: Quickshell.screens.length > 1 ? "󰍺" : "󰍹" onPressed: function(b) { root.toggle() } onWheelMoved: function(delta) { if (root.brightnessAvailable) root.setBrightness(root.brightnessPercent + (delta > 0 ? 5 : -5)) diff --git a/shell/plugins/panels/network/Panel.qml b/shell/plugins/panels/network/Panel.qml index 2d3c9bae..bdd81625 100644 --- a/shell/plugins/panels/network/Panel.qml +++ b/shell/plugins/panels/network/Panel.qml @@ -1505,7 +1505,7 @@ Panel { } Timer { - interval: 3000 + interval: 10000 running: true repeat: true triggeredOnStart: true