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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
f619c397f2
commit
4d630c9f30
@@ -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))
|
||||
|
||||
@@ -1505,7 +1505,7 @@ Panel {
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 3000
|
||||
interval: 10000
|
||||
running: true
|
||||
repeat: true
|
||||
triggeredOnStart: true
|
||||
|
||||
Reference in New Issue
Block a user