Extract system update bar widget

This commit is contained in:
David Heinemeier Hansson
2026-05-20 18:28:13 +02:00
parent 4835119e48
commit 1e63e86133
7 changed files with 60 additions and 40 deletions
@@ -0,0 +1,54 @@
import QtQuick
import Quickshell
import Quickshell.Io
import qs.Commons
import qs.Ui
BarWidget {
id: root
moduleName: "systemUpdate"
property bool updateAvailable: false
function refresh() {
if (!updateProc.running) updateProc.running = true
}
implicitWidth: button.implicitWidth
implicitHeight: button.implicitHeight
IpcHandler {
target: "systemUpdate"
function refresh(): void {
root.refresh()
}
}
Process {
id: updateProc
command: ["bash", "-lc", "omarchy-update-available"]
stdout: StdioCollector { waitForEnd: true }
onExited: function(exitCode) {
root.updateAvailable = exitCode === 0
}
}
Timer {
interval: 21600000
running: true
repeat: true
triggeredOnStart: true
onTriggered: root.refresh()
}
WidgetButton {
id: button
anchors.fill: parent
bar: root.bar
text: root.updateAvailable ? "\uf021" : ""
fontSize: Style.font.caption
tooltipText: root.updateAvailable ? "Omarchy update available" : ""
onPressed: function() { root.bar.run("omarchy-launch-floating-terminal-with-presentation omarchy-update") }
}
}