/ de-omarchy / bin / omarchy-theme-install
swadhinbiswas Initial de-omarchy: Omarchy UI layer for Arch-based distros · 8/22/2026
9f393b2
40 lines · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash

# omarchy:summary=Install a theme from a git repository
# omarchy:args=[git-repo-url]
# omarchy:examples=omarchy theme install https://github.com/example/omarchy-example-theme.git
# omarchy:examples=omarchy theme install [email protected]:example/omarchy-example-theme.git

if [[ -z $1 ]]; then
  echo -e "\e[32mSee https://omarchy.org/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/omarchy/themes
if ! git clone "$REPO_URL" "$THEME_PATH"; then
  echo "Error: Failed to clone theme repo."
  exit 1
fi

# Apply the new theme with omarchy-theme-set
omarchy-theme-set $THEME_NAME