Add remove menu and tune up theme-remove script
This commit is contained in:
parent
2cd841a687
commit
d1b09e27a0
@ -88,8 +88,8 @@ show_setup_menu() {
|
||||
}
|
||||
|
||||
show_install_menu() {
|
||||
case $(menu "Install" " Packages\n Theme\n Dropbox\n Steam\n Docker DBs") in
|
||||
*Packages*) terminal $OMARCHY_BIN_PATH/omarchy-cmd-install ;;
|
||||
case $(menu "Install" " Package\n Theme\n Dropbox\n Steam\n Docker DBs") in
|
||||
*Package*) terminal $OMARCHY_BIN_PATH/omarchy-cmd-install ;;
|
||||
*Theme*) terminal $OMARCHY_BIN_PATH/omarchy-theme-install ;;
|
||||
*Dropbox*) terminal $OMARCHY_BIN_PATH/omarchy-setup-dropbox ;;
|
||||
*Steam*) terminal $OMARCHY_BIN_PATH/omarchy-setup-steam ;;
|
||||
@ -98,6 +98,16 @@ show_install_menu() {
|
||||
esac
|
||||
}
|
||||
|
||||
show_remove_menu() {
|
||||
case $(menu "Remove" " Package\n Theme\n Fingerprint\n Fido2") in
|
||||
*Package*) terminal $OMARCHY_BIN_PATH/omarchy-cmd-uninstall ;;
|
||||
*Theme*) present_terminal $OMARCHY_BIN_PATH/omarchy-theme-remove ;;
|
||||
*Fingerprint*) terminal "$OMARCHY_BIN_PATH/omarchy-setup-fingerprint --remove" ;;
|
||||
*Fido2*) terminal "$OMARCHY_BIN_PATH/omarchy-setup-fido2 --remove" ;;
|
||||
*) show_main_menu ;;
|
||||
esac
|
||||
}
|
||||
|
||||
show_update_menu() {
|
||||
case $(menu "Update" " Omarchy ($OMARCHY_VERSION)\n Configs\n Themes\n Timezone") in
|
||||
*Omarchy*) terminal $OMARCHY_BIN_PATH/omarchy-update ;;
|
||||
@ -134,7 +144,7 @@ show_system_menu() {
|
||||
}
|
||||
|
||||
show_main_menu() {
|
||||
case $(menu "Start" " Apps\n Learning\n Capture\n Toggle\n Style\n Setup\n Install\n Update\n System") in
|
||||
case $(menu "Start" " Apps\n Learning\n Capture\n Toggle\n Style\n Setup\n Install\n Remove\n Update\n System") in
|
||||
*Apps*) walker -p "Launch…" ;;
|
||||
*Learn*) show_learn_menu ;;
|
||||
*Capture*) show_capture_menu ;;
|
||||
@ -142,6 +152,7 @@ show_main_menu() {
|
||||
*Style*) show_style_menu ;;
|
||||
*Setup*) show_setup_menu ;;
|
||||
*Install*) show_install_menu ;;
|
||||
*Remove*) show_remove_menu ;;
|
||||
*Update*) show_update_menu ;;
|
||||
*System*) show_system_menu ;;
|
||||
esac
|
||||
@ -157,6 +168,7 @@ case "$1" in
|
||||
*toggle*) show_toggle_menu ;;
|
||||
*setup*) show_setup_menu ;;
|
||||
*install*) show_install_menu ;;
|
||||
*remove*) show_remove_menu ;;
|
||||
*update*) show_update_menu ;;
|
||||
*system*) show_system_menu ;;
|
||||
*) show_main_menu ;;
|
||||
|
@ -4,17 +4,26 @@
|
||||
# Usage: omarchy-theme-remove <theme-name>
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: omarchy-theme-remove <theme-name>"
|
||||
exit 1
|
||||
extra_themes=$(find ~/.config/omarchy/themes -mindepth 1 -maxdepth 1 -type d ! -xtype l -printf '%f\n')
|
||||
|
||||
if [[ -n "$extra_themes" ]]; then
|
||||
THEME_NAME=$(gum choose --header="Remove extra theme" "$extra_themes")
|
||||
else
|
||||
echo "No extra themes installed."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
THEME_NAME="$1"
|
||||
fi
|
||||
|
||||
THEME_NAME="$1"
|
||||
THEMES_DIR="$HOME/.config/omarchy/themes"
|
||||
BACKGROUND_DIR="$HOME/.config/omarchy/backgrounds"
|
||||
CURRENT_DIR="$HOME/.config/omarchy/current"
|
||||
|
||||
THEME_PATH="$THEMES_DIR/$THEME_NAME"
|
||||
BACKGROUND_PATH="$BACKGROUND_DIR/$THEME_NAME"
|
||||
|
||||
# Ensure a theme was set
|
||||
if [ -z "$THEME_NAME" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if theme exists before attempting removal
|
||||
if [ ! -d "$THEME_PATH" ]; then
|
||||
@ -22,11 +31,10 @@ if [ ! -d "$THEME_PATH" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Use readlink -f to resolve symlinks and get the absolute path
|
||||
# Move to the next theme if the current theme is the one being removed
|
||||
if [ "$(readlink -f "$CURRENT_DIR/theme")" = "$(readlink -f "$THEME_PATH")" ]; then
|
||||
~/.local/share/omarchy/bin/omarchy-theme-next
|
||||
fi
|
||||
|
||||
# Now remove the theme directory and backgrounds for THEME_NAME
|
||||
# Now remove the theme directory for THEME_NAME
|
||||
rm -rf "$THEME_PATH"
|
||||
rm -rf "$BACKGROUND_PATH"
|
||||
|
Loading…
x
Reference in New Issue
Block a user