From e14d58fe54797492fc4f67ce554b76581a2433b7 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 17 Sep 2025 10:28:20 +0200 Subject: [PATCH] Allow changing Omarchy branches from the menu --- bin/omarchy-menu | 10 +++++++++- bin/omarchy-update-branch | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100755 bin/omarchy-update-branch diff --git a/bin/omarchy-menu b/bin/omarchy-menu index e037fde..352477d 100755 --- a/bin/omarchy-menu +++ b/bin/omarchy-menu @@ -383,8 +383,9 @@ show_remove_menu() { } show_update_menu() { - case $(menu "Update" " Omarchy\n Config\n󰸌 Extra Themes\n Process\n󰇅 Hardware\n Password\n Timezone") in + case $(menu "Update" " Omarchy\n Branch\n Config\n󰸌 Extra Themes\n Process\n󰇅 Hardware\n Password\n Timezone") in *Omarchy*) present_terminal omarchy-update ;; + *Branch*) show_update_branch_menu ;; *Config*) show_update_config_menu ;; *Themes*) present_terminal omarchy-theme-update ;; *Process*) show_update_process_menu ;; @@ -395,6 +396,13 @@ show_update_menu() { esac } +show_update_branch_menu() { + case $(menu "Branch" "master\ndev" "" "$(omarchy-version-branch)") in + *master*) omarchy-update-branch master ;; + *dev*) omarchy-update-branch dev ;; + *) show_update_menu ;; + esac +} show_update_process_menu() { case $(menu "Restart" " Hypridle\n Hyprsunset\n Swayosd\n󰌧 Walker\n󰍜 Waybar") in *Hypridle*) omarchy-restart-hypridle ;; diff --git a/bin/omarchy-update-branch b/bin/omarchy-update-branch new file mode 100755 index 0000000..a75cae9 --- /dev/null +++ b/bin/omarchy-update-branch @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e + +if (($# == 0)); then + echo "Usage: omarchy-verion-branch-set [master|dev]" + exit 1 +fi + +new_branch="$1" + +# Snapshot before switching branch +omarchy-snapshot create || [ $? -eq 127 ] + +# Checkout the new branch +git -C $OMARCHY_PATH checkout $new_branch --autostash +git -C $OMARCHY_PATH diff --check || git -C $OMARCHY_PATH reset --merge + +# Update the system from the new branch +omarchy-update-perform