feat(update): add interactive confirmation prompt to nomarchy-update and expose in all themes
Some checks failed
Check / eval-and-lint (push) Has been cancelled

This commit is contained in:
Bernardo Magri
2026-06-01 20:35:06 +01:00
parent dd72110b9a
commit dc7a3e2a29
3 changed files with 57 additions and 4 deletions

View File

@@ -78,7 +78,7 @@ Phase B (per-batch PRs) refines those into `port-from-omarchy`,
| `nomarchy-launch-bluetooth` | `features/scripts/utils` | core/home/config/nomarchy/default/hypr/bindings/utilities.conf,features/desktop/waybar/config/config.jsonc, +1 more | `kept` | |
| `nomarchy-launch-browser` | `features/scripts/utils` | core/home/config/nomarchy-skill/SKILL.md,features/desktop/hyprland/config/bindings.conf | `kept` | |
| `nomarchy-launch-editor` | `features/scripts/utils` | features/desktop/hyprland/config/bindings.conf,features/scripts/utils/nomarchy-menu, +1 more | `kept` | |
| `nomarchy-launch-floating-terminal-with-presentation` | `features/scripts/utils` | core/home/config/nomarchy/default/mako/core.ini,features/desktop/waybar/config/config.jsonc, +3 more | `kept` | |
| `nomarchy-launch-floating-terminal-with-presentation` | `features/scripts/utils` | core/home/config/nomarchy/default/mako/core.ini,features/desktop/waybar/config/config.jsonc, +4 more | `kept` | |
| `nomarchy-launch-or-focus` | `features/scripts/utils` | core/home/config/nomarchy/extensions/menu.sh,features/desktop/hyprland/config/bindings.conf, +8 more | `kept` | |
| `nomarchy-launch-or-focus-tui` | `features/scripts/utils` | core/home/config/nomarchy/extensions/menu.sh,features/desktop/waybar/config/config.jsonc, +5 more | `kept` | |
| `nomarchy-launch-or-focus-webapp` | `features/scripts/utils` | features/desktop/hyprland/config/bindings.conf | `kept` | |
@@ -169,8 +169,8 @@ Phase B (per-batch PRs) refines those into `port-from-omarchy`,
| `nomarchy-tui-remove` | `features/scripts/utils` | core/home/config/nomarchy-skill/SKILL.md | `kept` | |
| `nomarchy-tui-remove-all` | `features/scripts/utils` | core/home/config/nomarchy-skill/SKILL.md | `kept` | |
| `nomarchy-tz-select` | `core/system/scripts` | features/desktop/waybar/config/config.jsonc,features/scripts/utils/nomarchy-menu, +2 more | `kept` | |
| `nomarchy-update` | `core/system/scripts` | core/home/config/nomarchy-skill/SKILL.md,core/home/config/nomarchy/default/mako/core.ini, +4 more | `kept` | |
| `nomarchy-update-available` | `features/scripts/utils` | features/desktop/waybar/config/config.jsonc,features/desktop/waybar/themes/summer-night/config.jsonc | `kept` | |
| `nomarchy-update` | `core/system/scripts` | core/home/config/nomarchy-skill/SKILL.md,core/home/config/nomarchy/default/mako/core.ini, +5 more | `kept` | |
| `nomarchy-update-available` | `features/scripts/utils` | features/desktop/waybar/config/config.jsonc,features/desktop/waybar/themes/summer-day/config.jsonc, +1 more | `kept` | |
| `nomarchy-update-firmware` | `features/scripts/utils` | features/scripts/utils/nomarchy-menu | `kept` | |
| `nomarchy-update-time` | `core/system/scripts` | features/scripts/utils/nomarchy-menu | `kept` | |
| `nomarchy-upload-log` | `features/scripts/utils` | core/home/config/nomarchy-skill/SKILL.md,features/scripts/utils/nomarchy-debug | `kept` | |

View File

@@ -10,7 +10,7 @@
"spacing": 15,
"modules-left": ["custom/launcher", "clock", "clock#date"],
"modules-center": ["wlr/workspaces"],
"modules-right": ["pulseaudio", "network", "battery", "custom/powermenu"],
"modules-right": ["custom/update", "pulseaudio", "network", "battery", "custom/powermenu"],
"wlr/workspaces": {
"disable-scroll": true,
@@ -39,6 +39,15 @@
"tooltip-format": "Nomarchy Menu\n\nSuper + Shift + Space"
},
"custom/update": {
"format": "",
"exec": "nomarchy-update-available",
"on-click": "nomarchy-launch-floating-terminal-with-presentation nomarchy-update",
"tooltip-format": "Nomarchy update available",
"signal": 7,
"interval": 21600
},
"backlight": {
"max-length": "4",
"format": "{icon}",

View File

@@ -7,6 +7,17 @@
set -e
# Fast fail offline check for gum
if ! ping -c 1 -W 2 1.1.1.1 >/dev/null 2>&1; then
if command -v gum >/dev/null 2>&1; then
gum style --foreground 196 "You are offline. Cannot update."
sleep 3
else
echo "You are offline. Cannot update."
fi
exit 1
fi
# Detect the repository location
if [ -f "/etc/nixos/flake.nix" ]; then
REPO_DIR="/etc/nixos"
@@ -17,6 +28,33 @@ else
exit 1
fi
CURRENT_REV=$(jq -r '.nodes.nomarchy.locked.rev // empty' "$REPO_DIR/flake.lock" 2>/dev/null)
REMOTE_URL="https://git.bemagri.xyz/bernardo/Nomarchy.git"
LATEST_REV=$(git ls-remote "$REMOTE_URL" HEAD 2>/dev/null | awk '{print $1}')
if command -v gum >/dev/null 2>&1; then
gum style --foreground 212 --border double --margin "1 2" --padding "1 2" "Nomarchy System Update"
if [[ "$CURRENT_REV" != "$LATEST_REV" && -n "$LATEST_REV" ]]; then
echo -e "An update for Nomarchy is available!\n"
echo -e "Current Revision: ${CURRENT_REV:0:7}"
echo -e "Latest Revision: ${LATEST_REV:0:7}\n"
if ! gum confirm "Do you want to download and apply the update now?"; then
echo "Update cancelled."
sleep 2
exit 0
fi
else
echo -e "\nYou are already up to date! (${CURRENT_REV:0:7})"
if ! gum confirm "Do you want to force a system rebuild anyway?"; then
echo "Cancelled."
sleep 2
exit 0
fi
fi
fi
echo "--- Starting Nomarchy Full Update ---"
# 1. Unpin the flake if it's currently pinned to the install commit
@@ -33,3 +71,9 @@ sudo nix --extra-experimental-features 'nix-command flakes' flake update --flake
nomarchy-sys-update
echo "--- Nomarchy Full Update Complete ---"
if command -v gum >/dev/null 2>&1; then
echo ""
gum style --foreground 82 "Update Applied Successfully!"
echo "Press any key to exit."
read -n 1 -s -r
fi