Add omarchy-theme-dir and use it to resolve theme paths

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-07-24 12:19:39 -07:00
co-authored by Claude Opus 5
parent 6aaa5b764e
commit 2996ee6327
5 changed files with 22 additions and 26 deletions
+1 -7
View File
@@ -13,13 +13,7 @@ if cmp -s "$OMARCHY_PATH/default/plymouth/logo.png" "$installed_logo"; then
fi fi
omarchy-plymouth-list | while read -r name; do omarchy-plymouth-list | while read -r name; do
if [[ -d ~/.config/omarchy/themes/$name ]]; then if cmp -s "$(omarchy-theme-dir "$name")/unlock.png" "$installed_logo"; then
theme_dir=~/.config/omarchy/themes/$name
else
theme_dir="$OMARCHY_PATH/themes/$name"
fi
if cmp -s "$theme_dir/unlock.png" "$installed_logo"; then
echo "$name" echo "$name"
exit exit
fi fi
+1 -7
View File
@@ -7,13 +7,7 @@
find ~/.config/omarchy/themes/ -mindepth 1 -maxdepth 1 \( -type d -o -type l \) -printf '%f\n' 2>/dev/null find ~/.config/omarchy/themes/ -mindepth 1 -maxdepth 1 \( -type d -o -type l \) -printf '%f\n' 2>/dev/null
find "$OMARCHY_PATH/themes/" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' find "$OMARCHY_PATH/themes/" -mindepth 1 -maxdepth 1 -type d -printf '%f\n'
} | sort -u | while read -r name; do } | sort -u | while read -r name; do
if [[ -d ~/.config/omarchy/themes/$name ]]; then if [[ -f $(omarchy-theme-dir "$name")/preview-unlock.png ]]; then
theme_dir=~/.config/omarchy/themes/$name
else
theme_dir="$OMARCHY_PATH/themes/$name"
fi
if [[ -f $theme_dir/preview-unlock.png ]]; then
echo "$name" echo "$name"
fi fi
done done
+1 -5
View File
@@ -14,11 +14,7 @@ fi
theme=$1 theme=$1
if [[ -d ~/.config/omarchy/themes/$theme ]]; then theme_dir=$(omarchy-theme-dir "$theme")
theme_dir=~/.config/omarchy/themes/$theme
else
theme_dir="$OMARCHY_PATH/themes/$theme"
fi
theme_color() { theme_color() {
local key="$1" local key="$1"
+1 -7
View File
@@ -10,13 +10,7 @@ mkdir -p "$preview_dir"
ln -s "$OMARCHY_PATH/default/plymouth/preview-unlock.png" "$preview_dir/default.png" ln -s "$OMARCHY_PATH/default/plymouth/preview-unlock.png" "$preview_dir/default.png"
omarchy-plymouth-list | while read -r name; do omarchy-plymouth-list | while read -r name; do
if [[ -d ~/.config/omarchy/themes/$name ]]; then ln -s "$(omarchy-theme-dir "$name")/preview-unlock.png" "$preview_dir/$name.png" 2>/dev/null
theme_dir=~/.config/omarchy/themes/$name
else
theme_dir="$OMARCHY_PATH/themes/$name"
fi
ln -s "$theme_dir/preview-unlock.png" "$preview_dir/$name.png" 2>/dev/null
done done
current=$(omarchy-plymouth-current) current=$(omarchy-plymouth-current)
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
# omarchy:summary=Print the directory holding a theme, preferring a user-installed copy
# omarchy:args=<theme-name>
# omarchy:examples=omarchy theme dir tokyo-night
theme="${1:-}"
if [[ -z $theme ]]; then
echo "Usage: omarchy-theme-dir <theme-name>" >&2
exit 1
fi
if [[ -d $HOME/.config/omarchy/themes/$theme ]]; then
echo "$HOME/.config/omarchy/themes/$theme"
else
echo "$OMARCHY_PATH/themes/$theme"
fi