Refresh bar widgets on every monitor, not just one

A bar surface is built per monitor, so a widget in the layout is live once
per screen — but an IPC target only ever routes to the handler that
registered first. `omarchy.indicators refresh` therefore reached a single
bar, and since indicators only re-read their state on that signal, the
other screens kept showing a stale reminder count, tmux alert, or DND
state until the next reload. Clock and system-update refreshes had the
same reach.

Let the bar resolve every live instance of a widget id and relay the call
to all of them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-07-24 14:16:22 -07:00
co-authored by Claude Opus 5
parent 49efe2dafa
commit d2e1587ceb
6 changed files with 36 additions and 9 deletions
+12
View File
@@ -22,6 +22,18 @@ Item {
readonly property bool vertical: bar ? bar.vertical : false
readonly property int barSize: bar ? bar.barSize : Style.bar.sizeHorizontal
// Run `method` on every live instance of this widget. An IPC target only
// ever routes to one handler, but a bar surface exists per monitor, so the
// instance that owns the target relays the call to its peers — otherwise a
// refresh would land on a single screen and leave the others stale.
function broadcast(method) {
var items = bar && typeof bar.moduleWidgets === "function"
? bar.moduleWidgets(moduleName) : [root]
for (var i = 0; i < items.length; i++) {
if (items[i] && typeof items[i][method] === "function") items[i][method]()
}
}
// Read a single value from this widget's inline shell.json entry, with a
// fallback for missing/null values. Every widget that takes user-tunable
// settings needs this; defining it once on the base keeps the wiring