Simplify system update popover

This commit is contained in:
Ryan Hughes
2026-06-04 19:23:54 -04:00
parent 92de15214c
commit e5516d882d
2 changed files with 58 additions and 10 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ gum style --border normal --padding "1 2" \
"• You cannot stop the update once you start!" \ "• You cannot stop the update once you start!" \
"• Make sure you're connected to power or have a full battery" \ "• Make sure you're connected to power or have a full battery" \
"" \ "" \
"What's new: https://github.com/basecamp/omarchy/releases" "What's new: https://github.com/basecamp/omarchy/releases/latest"
echo echo
+57 -9
View File
@@ -26,6 +26,7 @@ BarWidget {
readonly property color urgent: root.bar ? root.bar.urgent : Color.urgent readonly property color urgent: root.bar ? root.bar.urgent : Color.urgent
readonly property color dim: Qt.darker(foreground, 1.55) readonly property color dim: Qt.darker(foreground, 1.55)
readonly property string fontFamily: root.bar ? root.bar.fontFamily : Style.font.family readonly property string fontFamily: root.bar ? root.bar.fontFamily : Style.font.family
readonly property string changelogUrl: "https://github.com/basecamp/omarchy/releases/latest"
function close() { popupOpen = false } function close() { popupOpen = false }
@@ -48,6 +49,10 @@ BarWidget {
if (root.bar) root.bar.run("omarchy-launch-floating-terminal-with-presentation omarchy-update") if (root.bar) root.bar.run("omarchy-launch-floating-terminal-with-presentation omarchy-update")
} }
function openChangelog() {
Qt.openUrlExternally(root.changelogUrl)
}
function packageName(line) { function packageName(line) {
return String(line || "").trim().split(/\s+/)[0] || "" return String(line || "").trim().split(/\s+/)[0] || ""
} }
@@ -75,6 +80,10 @@ BarWidget {
return count === 1 ? "1 update" : count + " updates" return count === 1 ? "1 update" : count + " updates"
} }
function pendingPackageLabel(count) {
return count === 1 ? "1 package pending update" : count + " packages pending update"
}
function parseUpdateText(text) { function parseUpdateText(text) {
var lines = String(text || "").split(/\r?\n/).filter(function(line) { var lines = String(text || "").split(/\r?\n/).filter(function(line) {
return line.trim().length > 0 return line.trim().length > 0
@@ -187,8 +196,8 @@ BarWidget {
bar: root.bar bar: root.bar
open: root.popupOpen && root.updateAvailable open: root.popupOpen && root.updateAvailable
triggerMode: "hover" triggerMode: "hover"
contentWidth: popup.fittedContentWidth(Style.space(460)) contentWidth: popup.fittedContentWidth(Style.space(420))
contentHeight: popup.fittedContentHeight(panelColumn.implicitHeight, Style.space(640)) contentHeight: popup.fittedContentHeight(panelColumn.implicitHeight + Style.space(4), Style.space(640))
Flickable { Flickable {
id: updateFlick id: updateFlick
@@ -243,6 +252,7 @@ BarWidget {
title: "Omarchy" title: "Omarchy"
lines: root.omarchyUpdateLines lines: root.omarchyUpdateLines
important: true important: true
showChangelog: true
width: parent.width width: parent.width
} }
@@ -251,9 +261,8 @@ BarWidget {
foreground: root.foreground foreground: root.foreground
} }
UpdateSection { OtherPackagesSummary {
title: "Other packages" count: root.otherUpdateLines.length
lines: root.otherUpdateLines
width: parent.width width: parent.width
} }
} }
@@ -266,13 +275,14 @@ BarWidget {
property string title: "" property string title: ""
property var lines: [] property var lines: []
property bool important: false property bool important: false
property bool showChangelog: false
visible: lines.length > 0 visible: lines.length > 0
spacing: Style.space(8) spacing: Style.space(8)
PanelSectionHeader { PanelSectionHeader {
width: section.width width: section.width
text: section.title.toUpperCase() + " (" + section.lines.length + ")" text: section.title.toUpperCase()
foreground: root.foreground foreground: root.foreground
fontFamily: root.fontFamily fontFamily: root.fontFamily
} }
@@ -291,6 +301,46 @@ BarWidget {
} }
} }
} }
Button {
visible: section.showChangelog
width: section.width
text: "View latest release notes"
iconText: "\uf08e"
foreground: root.foreground
accent: root.urgent
fontFamily: root.fontFamily
fontSize: Style.font.bodySmall
iconSize: Style.font.body
bordered: true
onClicked: root.openChangelog()
}
}
component OtherPackagesSummary: Column {
id: summary
property int count: 0
visible: count > 0
spacing: Style.space(8)
PanelSectionHeader {
width: summary.width
text: "OTHER PACKAGES"
foreground: root.foreground
fontFamily: root.fontFamily
}
Text {
width: summary.width
text: root.pendingPackageLabel(summary.count)
color: root.foreground
font.family: root.fontFamily
font.pixelSize: Style.font.body
font.bold: true
elide: Text.ElideRight
}
} }
component UpdateRow: CursorSurface { component UpdateRow: CursorSurface {
@@ -326,13 +376,12 @@ BarWidget {
elide: Text.ElideRight elide: Text.ElideRight
} }
RowLayout { Row {
visible: row.hasVersions visible: row.hasVersions
Layout.fillWidth: true Layout.fillWidth: true
spacing: Style.space(7) spacing: Style.space(7)
Text { Text {
Layout.fillWidth: true
text: row.fromVersion text: row.fromVersion
color: root.dim color: root.dim
font.family: root.fontFamily font.family: root.fontFamily
@@ -349,7 +398,6 @@ BarWidget {
} }
Text { Text {
Layout.fillWidth: true
text: row.toVersion text: row.toVersion
color: row.important ? root.urgent : root.foreground color: row.important ? root.urgent : root.foreground
font.family: root.fontFamily font.family: root.fontFamily