From b48dca29e6707f808d2a09a74dcb72f24e5e8aed Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 24 May 2026 15:44:50 +0200 Subject: [PATCH] Make sure system updates sit in the right place --- config/omarchy/shell.json | 4 +-- migrations/1779627463.sh | 42 ++++++++++++++++++++++ shell/plugins/bar/widgets/SystemUpdate.qml | 1 + shell/plugins/settings/SettingsPanel.qml | 2 +- 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 migrations/1779627463.sh diff --git a/config/omarchy/shell.json b/config/omarchy/shell.json index abb2bf5f..b1997a36 100644 --- a/config/omarchy/shell.json +++ b/config/omarchy/shell.json @@ -28,10 +28,10 @@ "id": "omarchy.weather" }, { - "id": "omarchy.indicators" + "id": "omarchy.system-update" }, { - "id": "omarchy.system-update" + "id": "omarchy.indicators" } ], "right": [ diff --git a/migrations/1779627463.sh b/migrations/1779627463.sh new file mode 100644 index 00000000..85d7bb46 --- /dev/null +++ b/migrations/1779627463.sh @@ -0,0 +1,42 @@ +echo "Place the system update indicator next to weather in the bar" + +config_file="$HOME/.config/omarchy/shell.json" + +if [[ -s $config_file ]] && omarchy-cmd-present jq; then + tmp=$(mktemp) + jq ' + def entry_id: + if type == "string" then + . + elif type == "object" then + (.id // "") + else + "" + end; + + def entry_index($id): + [range(0; length) as $i | select((.[$i] | entry_id) == $id) | $i][0]; + + def place_update_after_weather: + if type != "array" then + . + else + (entry_index("omarchy.weather")) as $weather_index | + (entry_index("omarchy.indicators")) as $indicators_index | + (entry_index("omarchy.system-update")) as $update_index | + if $weather_index == null or $indicators_index == null or $update_index == null then + . + elif $weather_index < $indicators_index and $indicators_index < $update_index then + . as $entries | + ($entries[$update_index]) as $update_entry | + ($entries | del(.[$update_index])) as $without_update | + ($without_update | entry_index("omarchy.weather")) as $new_weather_index | + $without_update[0:$new_weather_index + 1] + [$update_entry] + $without_update[$new_weather_index + 1:] + else + . + end + end; + + .bar.layout.center |= place_update_after_weather + ' "$config_file" >"$tmp" && mv "$tmp" "$config_file" || rm -f "$tmp" +fi diff --git a/shell/plugins/bar/widgets/SystemUpdate.qml b/shell/plugins/bar/widgets/SystemUpdate.qml index 218f8dd3..64e8b0d6 100644 --- a/shell/plugins/bar/widgets/SystemUpdate.qml +++ b/shell/plugins/bar/widgets/SystemUpdate.qml @@ -14,6 +14,7 @@ BarWidget { if (!updateProc.running) updateProc.running = true } + visible: updateAvailable implicitWidth: button.implicitWidth implicitHeight: button.implicitHeight diff --git a/shell/plugins/settings/SettingsPanel.qml b/shell/plugins/settings/SettingsPanel.qml index 15ee0c4a..4f851082 100644 --- a/shell/plugins/settings/SettingsPanel.qml +++ b/shell/plugins/settings/SettingsPanel.qml @@ -133,7 +133,7 @@ Item { left: [{ id: "omarchy.menu" }, { id: "omarchy.workspaces" }], center: [ { id: "omarchy.clock", format: "dddd HH:mm", formatAlt: "dd MMMM 'W'ww yyyy", verticalFormat: "HH\n\u2014\nmm" }, - { id: "omarchy.weather" }, { id: "omarchy.indicators" }, { id: "omarchy.system-update" } + { id: "omarchy.weather" }, { id: "omarchy.system-update" }, { id: "omarchy.indicators" } ], right: [ { id: "omarchy.tray" }, { id: "omarchy.bluetooth" }, { id: "omarchy.network" },