Make status indicators event-driven instead of polling

The indicators widget broadcast a refresh every 2s, fanning out to four
status subprocesses (nightlight, idle, reminder, screen-recording), and
NightLight/StayAwake each ran an additional 5s poll. On an idle desktop
this was the dominant source of process churn (~33 of ~53 forks/sec in a
VM). The state-changing commands already push `omarchy.indicators
refresh` over IPC, so the polling was redundant.

Drop the 2s broadcast and the two 5s timers; indicators now refresh at
startup and on the IPC push. Also fix three callers that pushed to the
wrong target `Indicators` instead of `omarchy.indicators` (screen
recording, notification silencing, and the omarchy-shell help example) —
those pushes silently failed and only appeared to work because the poll
masked them.

Idle fork rate drops ~53/s to ~20/s.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-07-19 22:46:27 -07:00
co-authored by Claude Fable 5
parent ca4b0b3b61
commit f619c397f2
6 changed files with 4 additions and 24 deletions
+1 -1
View File
@@ -222,7 +222,7 @@ stop_screenrecording() {
} }
toggle_screenrecording_indicator() { toggle_screenrecording_indicator() {
omarchy-shell -q Indicators refresh omarchy-shell -q omarchy.indicators refresh
} }
screenrecording_active() { screenrecording_active() {
+1 -1
View File
@@ -29,7 +29,7 @@ Options:
Examples: Examples:
omarchy-shell shell ping omarchy-shell shell ping
omarchy-shell -q Indicators refresh omarchy-shell -q omarchy.indicators refresh
omarchy-shell shell listPlugins omarchy-shell shell listPlugins
omarchy-shell shell toggle omarchy.menu '{"menu":"root"}' omarchy-shell shell toggle omarchy.menu '{"menu":"root"}'
USAGE USAGE
+1 -1
View File
@@ -3,4 +3,4 @@
# omarchy:summary=Toggle notification do-not-disturb mode # omarchy:summary=Toggle notification do-not-disturb mode
state=$(omarchy-shell notifications toggleDnd 2>/dev/null || echo "") state=$(omarchy-shell notifications toggleDnd 2>/dev/null || echo "")
omarchy-shell -q Indicators refresh omarchy-shell -q omarchy.indicators refresh
@@ -54,12 +54,5 @@ BarIndicator {
onTriggered: root.refresh() onTriggered: root.refresh()
} }
Timer {
interval: 5000
running: true
repeat: true
onTriggered: root.refresh()
}
onPressed: function() { root.toggle() } onPressed: function() { root.toggle() }
} }
@@ -48,12 +48,5 @@ BarIndicator {
onTriggered: root.refresh() onTriggered: root.refresh()
} }
Timer {
interval: 5000
running: true
repeat: true
onTriggered: root.refresh()
}
onPressed: function() { root.toggle() } onPressed: function() { root.toggle() }
} }
+1 -7
View File
@@ -174,13 +174,7 @@ BarWidget {
} }
} }
Timer { Component.onCompleted: root.refreshRequested()
interval: 2000
running: true
repeat: true
triggeredOnStart: true
onTriggered: root.refreshRequested()
}
Row { Row {
id: horizontalIndicators id: horizontalIndicators