40 lines
1.2 KiB
Bash
Executable File
40 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# archypr:summary=Install a theme from a git repository
|
|
# archypr:args=[git-repo-url]
|
|
# archypr:examples=omarchy theme install https://github.com/example/archypr-xample-theme.git
|
|
# archypr:examples=omarchy theme install git@github.com:example/archypr-xample-theme.git
|
|
|
|
if [[ -z $1 ]]; then
|
|
echo -e "\e[32mSee https://manuals.omamix.org/2/the-archypr-anual/90/extra-themes\n\e[0m"
|
|
REPO_URL=$(gum input --placeholder="Git repo URL (https or git@host:org/repo.git)" --header="")
|
|
else
|
|
REPO_URL="$1"
|
|
fi
|
|
|
|
if [[ -z $REPO_URL ]]; then
|
|
exit 1
|
|
fi
|
|
|
|
THEMES_DIR="$HOME/.config/omarchy/themes"
|
|
|
|
# Strip user@host: prefix from scp-style SSH URLs so basename sees just the path
|
|
REPO_PATH="$REPO_URL"
|
|
[[ $REPO_PATH != *"://"* && $REPO_PATH == *:*/* ]] && REPO_PATH="${REPO_PATH#*:}"
|
|
THEME_NAME=$(basename "$REPO_PATH" .git | sed -E 's/^omarchy-//; s/-theme$//' | tr '[:upper:]' '[:lower:]')
|
|
THEME_PATH="$THEMES_DIR/$THEME_NAME"
|
|
|
|
# Remove existing theme if present
|
|
if [[ -d $THEME_PATH ]]; then
|
|
rm -rf "$THEME_PATH"
|
|
fi
|
|
|
|
# Clone the repo directly to ~/.config/archypr/themes
|
|
if ! git clone "$REPO_URL" "$THEME_PATH"; then
|
|
echo "Error: Failed to clone theme repo."
|
|
exit 1
|
|
fi
|
|
|
|
# Apply the new theme with archypr-theme-set
|
|
archypr-heme-set $THEME_NAME
|