Extract system update bar widget
This commit is contained in:
@@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
# omarchy:summary=Ensure the status bar icon offering the available update is removed
|
# omarchy:summary=Ensure the status bar icon offering the available update is removed
|
||||||
|
|
||||||
omarchy-shell -q bar refreshUpdate
|
omarchy-shell -q systemUpdate refresh
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ Item {
|
|||||||
Behavior on foreground { ColorAnimation { duration: 420; easing.type: Easing.InOutCubic } }
|
Behavior on foreground { ColorAnimation { duration: 420; easing.type: Easing.InOutCubic } }
|
||||||
Behavior on background { ColorAnimation { duration: 420; easing.type: Easing.InOutCubic } }
|
Behavior on background { ColorAnimation { duration: 420; easing.type: Easing.InOutCubic } }
|
||||||
Behavior on urgent { ColorAnimation { duration: 420; easing.type: Easing.InOutCubic } }
|
Behavior on urgent { ColorAnimation { duration: 420; easing.type: Easing.InOutCubic } }
|
||||||
property bool updateAvailable: false
|
|
||||||
property bool clockAlt: false
|
property bool clockAlt: false
|
||||||
property var tooltipTarget: null
|
property var tooltipTarget: null
|
||||||
property var pendingTooltipTarget: null
|
property var pendingTooltipTarget: null
|
||||||
@@ -259,7 +258,6 @@ Item {
|
|||||||
function builtinModuleComponent(name) {
|
function builtinModuleComponent(name) {
|
||||||
switch (String(name)) {
|
switch (String(name)) {
|
||||||
case "clock": return clockModuleComponent
|
case "clock": return clockModuleComponent
|
||||||
case "update": return updateModuleComponent
|
|
||||||
case "indicators": return indicatorsModuleComponent
|
case "indicators": return indicatorsModuleComponent
|
||||||
case "tray": return trayModuleComponent
|
case "tray": return trayModuleComponent
|
||||||
default: return null
|
default: return null
|
||||||
@@ -366,10 +364,6 @@ Item {
|
|||||||
clearTooltip()
|
clearTooltip()
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshUpdate() {
|
|
||||||
runProcess(updateProc)
|
|
||||||
}
|
|
||||||
|
|
||||||
function refreshIndicators() {
|
function refreshIndicators() {
|
||||||
indicatorsRefreshRequested()
|
indicatorsRefreshRequested()
|
||||||
}
|
}
|
||||||
@@ -459,23 +453,6 @@ Item {
|
|||||||
onFileChanged: barHiddenProbe.running = true
|
onFileChanged: barHiddenProbe.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
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.refreshUpdate()
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
interval: 2000
|
interval: 2000
|
||||||
running: true
|
running: true
|
||||||
@@ -487,10 +464,6 @@ Item {
|
|||||||
IpcHandler {
|
IpcHandler {
|
||||||
target: "bar"
|
target: "bar"
|
||||||
|
|
||||||
function refreshUpdate(): void {
|
|
||||||
root.refreshUpdate()
|
|
||||||
}
|
|
||||||
|
|
||||||
function refreshScreenRecording(): void {
|
function refreshScreenRecording(): void {
|
||||||
root.refreshIndicators()
|
root.refreshIndicators()
|
||||||
}
|
}
|
||||||
@@ -646,7 +619,6 @@ Item {
|
|||||||
|
|
||||||
Component { id: emptyModuleComponent; Item { implicitWidth: 0; implicitHeight: 0; visible: false } }
|
Component { id: emptyModuleComponent; Item { implicitWidth: 0; implicitHeight: 0; visible: false } }
|
||||||
Component { id: clockModuleComponent; ClockModule {} }
|
Component { id: clockModuleComponent; ClockModule {} }
|
||||||
Component { id: updateModuleComponent; UpdateModule {} }
|
|
||||||
Component { id: indicatorsModuleComponent; IndicatorsModule {} }
|
Component { id: indicatorsModuleComponent; IndicatorsModule {} }
|
||||||
Component { id: trayModuleComponent; TrayModule {} }
|
Component { id: trayModuleComponent; TrayModule {} }
|
||||||
|
|
||||||
@@ -1385,13 +1357,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component UpdateModule: ModuleButton {
|
|
||||||
text: root.updateAvailable ? "" : ""
|
|
||||||
fontSize: Style.font.caption
|
|
||||||
tooltipText: root.updateAvailable ? "Omarchy update available" : ""
|
|
||||||
onPressed: function() { root.run("omarchy-launch-floating-terminal-with-presentation omarchy-update") }
|
|
||||||
}
|
|
||||||
|
|
||||||
component TrayModule: Item {
|
component TrayModule: Item {
|
||||||
id: trayRoot
|
id: trayRoot
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ QtObject {
|
|||||||
"bluetoothPanel": { displayName: "Bluetooth", description: "Bluetooth device list with connect/disconnect", category: "Network", allowMultiple: false, sourceDir: "../panels", sourceName: "Bluetooth" },
|
"bluetoothPanel": { displayName: "Bluetooth", description: "Bluetooth device list with connect/disconnect", category: "Network", allowMultiple: false, sourceDir: "../panels", sourceName: "Bluetooth" },
|
||||||
"daytime": { displayName: "Daytime", description: "Day/time label with date tooltip", category: "Time", allowMultiple: false, settingsForm: "daytimeSettings" },
|
"daytime": { displayName: "Daytime", description: "Day/time label with date tooltip", category: "Time", allowMultiple: false, settingsForm: "daytimeSettings" },
|
||||||
"notificationCenter": { displayName: "Notification center", description: "Recent notifications + DND", category: "Status", allowMultiple: false },
|
"notificationCenter": { displayName: "Notification center", description: "Recent notifications + DND", category: "Status", allowMultiple: false },
|
||||||
|
"systemUpdate": { displayName: "System update", description: "Indicates available system updates", category: "System", allowMultiple: false },
|
||||||
"systemStats": { displayName: "System stats", description: "CPU icon — hover for graphs, click to open btop", category: "System", allowMultiple: false },
|
"systemStats": { displayName: "System stats", description: "CPU icon — hover for graphs, click to open btop", category: "System", allowMultiple: false },
|
||||||
"weather": { displayName: "Weather", description: "Weather pill with detail popup", category: "Info", allowMultiple: false, settingsForm: "weatherSettings" },
|
"weather": { displayName: "Weather", description: "Weather pill with detail popup", category: "Info", allowMultiple: false, settingsForm: "weatherSettings" },
|
||||||
"microphone": { displayName: "Microphone", description: "Mic input state and mute toggle", category: "Audio", allowMultiple: false },
|
"microphone": { displayName: "Microphone", description: "Mic input state and mute toggle", category: "Audio", allowMultiple: false },
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ Example `shell.json` (bar subtree only shown):
|
|||||||
| `media` | MPRIS now-playing — scrolling track + artist, cover-art popup | left = play/pause · middle = next · scroll = prev/next · right = popup |
|
| `media` | MPRIS now-playing — scrolling track + artist, cover-art popup | left = play/pause · middle = next · scroll = prev/next · right = popup |
|
||||||
| `daytime` | Day/time label with date tooltip | hover = date |
|
| `daytime` | Day/time label with date tooltip | hover = date |
|
||||||
| `notificationCenter` | Bell with badge + popup with recent notifications, DND toggle | left = popup · right = toggle DND |
|
| `notificationCenter` | Bell with badge + popup with recent notifications, DND toggle | left = popup · right = toggle DND |
|
||||||
|
| `systemUpdate` | Available update indicator | left = update |
|
||||||
| `systemStats` | Inline CPU + memory sparklines, popup with detail | left = popup · right = terminal |
|
| `systemStats` | Inline CPU + memory sparklines, popup with detail | left = popup · right = terminal |
|
||||||
| `weather` | Weather icon + popup with forecast | left = popup · right = full notification |
|
| `weather` | Weather icon + popup with forecast | left = popup · right = full notification |
|
||||||
| `microphone` | Mic icon + scroll volume | left = mute toggle · middle = audio panel · scroll = source volume |
|
| `microphone` | Mic icon + scroll volume | left = mute toggle · middle = audio panel · scroll = source volume |
|
||||||
@@ -75,7 +76,7 @@ Example `shell.json` (bar subtree only shown):
|
|||||||
|
|
||||||
### Built-in base modules (in `Bar.qml`)
|
### Built-in base modules (in `Bar.qml`)
|
||||||
|
|
||||||
`clock`, `update`, `indicators`, `tray`.
|
`clock`, `indicators`, `tray`.
|
||||||
|
|
||||||
The `indicators` module loads individual bar indicators from `indicators/`, ordered by its `items` array in `shell.json`. Rich panels such as `powerPanel`, `networkPanel`, and `audioPanel` live in `../panels/` above.
|
The `indicators` module loads individual bar indicators from `indicators/`, ordered by its `items` array in `shell.json`. Rich panels such as `powerPanel`, `networkPanel`, and `audioPanel` live in `../panels/` above.
|
||||||
|
|
||||||
|
|||||||
@@ -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") }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -133,7 +133,7 @@ Item {
|
|||||||
left: [{ id: "omarchy" }, { id: "workspaces" }],
|
left: [{ id: "omarchy" }, { id: "workspaces" }],
|
||||||
center: [
|
center: [
|
||||||
{ id: "daytime", format: "dddd HH:mm", formatAlt: "dd MMMM yyyy", verticalFormat: "HH\n\u2014\nmm" },
|
{ id: "daytime", format: "dddd HH:mm", formatAlt: "dd MMMM yyyy", verticalFormat: "HH\n\u2014\nmm" },
|
||||||
{ id: "weather" }, { id: "indicators", items: [ "dnd", "nightlight", "stayAwake", "screenrecording", "dictation" ] }, { id: "update" }
|
{ id: "weather" }, { id: "indicators", items: [ "dnd", "nightlight", "stayAwake", "screenrecording", "dictation" ] }, { id: "systemUpdate" }
|
||||||
],
|
],
|
||||||
right: [
|
right: [
|
||||||
{ id: "tray" }, { id: "bluetoothPanel" }, { id: "networkPanel" },
|
{ id: "tray" }, { id: "bluetoothPanel" }, { id: "networkPanel" },
|
||||||
@@ -292,7 +292,6 @@ Item {
|
|||||||
// ---------------- widget catalog -----------------------------------------
|
// ---------------- widget catalog -----------------------------------------
|
||||||
readonly property var builtinWidgetMeta: ({
|
readonly property var builtinWidgetMeta: ({
|
||||||
"clock": { name: "Clock", description: "Date / time text", category: "Time" },
|
"clock": { name: "Clock", description: "Date / time text", category: "Time" },
|
||||||
"update": { name: "Updates", description: "Indicates available system updates", category: "System" },
|
|
||||||
"indicators": { name: "Indicators", description: "Manual state indicators", category: "Status" },
|
"indicators": { name: "Indicators", description: "Manual state indicators", category: "Status" },
|
||||||
"tray": { name: "System tray", description: "Status notifier items", category: "Status" }
|
"tray": { name: "System tray", description: "Status notifier items", category: "Status" }
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "update"
|
"id": "systemUpdate"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"right": [
|
"right": [
|
||||||
|
|||||||
Reference in New Issue
Block a user