Allow changing Omarchy branches from the menu

This commit is contained in:
David Heinemeier Hansson
2025-09-17 10:28:20 +02:00
parent f592bca968
commit e14d58fe54
2 changed files with 29 additions and 1 deletions

View File

@@ -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 ;;

20
bin/omarchy-update-branch Executable file
View File

@@ -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