Files
omarchycn/shell/plugins/bar/widgets/SystemUpdate.qml
T
David Heinemeier HanssonandClaude Opus 5 d2e1587ceb 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>
2026-07-24 14:16:22 -07:00

66 lines
1.3 KiB
QML

import QtQuick
import Quickshell
import Quickshell.Io
import qs.Commons
import qs.Ui
BarWidget {
id: root
moduleName: "omarchy.system-update"
property bool updateAvailable: false
function refresh() {
if (!updateProc.running) updateProc.running = true
}
function clear() { updateAvailable = false }
function runUpdate() {
if (root.bar) root.bar.run("omarchy-launch-floating-terminal-with-presentation omarchy-update")
}
visible: updateAvailable
implicitWidth: button.implicitWidth
implicitHeight: button.implicitHeight
IpcHandler {
target: "omarchy.system-update"
function refresh(): void {
root.broadcast("refresh")
}
function clear(): void {
root.broadcast("clear")
}
}
Process {
id: updateProc
command: ["omarchy-update-available"]
onExited: function(exitCode) {
root.updateAvailable = exitCode === 0
}
}
Timer {
interval: 21600000
running: true
repeat: true
triggeredOnStart: true
onTriggered: root.refresh()
}
BarIconButton {
id: button
anchors.fill: parent
bar: root.bar
text: "\uf021"
slotSize: Style.bar.statusSlot
fontSize: Style.font.caption
tooltipText: "Pending Omarchy Updates"
onPressed: root.runUpdate()
}
}