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:
co-authored by
Claude Opus 5
parent
6aaa5b764e
commit
2996ee6327
@@ -13,13 +13,7 @@ if cmp -s "$OMARCHY_PATH/default/plymouth/logo.png" "$installed_logo"; then
|
||||
fi
|
||||
|
||||
omarchy-plymouth-list | while read -r name; do
|
||||
if [[ -d ~/.config/omarchy/themes/$name ]]; 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
|
||||
if cmp -s "$(omarchy-theme-dir "$name")/unlock.png" "$installed_logo"; then
|
||||
echo "$name"
|
||||
exit
|
||||
fi
|
||||
|
||||
@@ -7,13 +7,7 @@
|
||||
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'
|
||||
} | sort -u | while read -r name; do
|
||||
if [[ -d ~/.config/omarchy/themes/$name ]]; then
|
||||
theme_dir=~/.config/omarchy/themes/$name
|
||||
else
|
||||
theme_dir="$OMARCHY_PATH/themes/$name"
|
||||
fi
|
||||
|
||||
if [[ -f $theme_dir/preview-unlock.png ]]; then
|
||||
if [[ -f $(omarchy-theme-dir "$name")/preview-unlock.png ]]; then
|
||||
echo "$name"
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -14,11 +14,7 @@ fi
|
||||
|
||||
theme=$1
|
||||
|
||||
if [[ -d ~/.config/omarchy/themes/$theme ]]; then
|
||||
theme_dir=~/.config/omarchy/themes/$theme
|
||||
else
|
||||
theme_dir="$OMARCHY_PATH/themes/$theme"
|
||||
fi
|
||||
theme_dir=$(omarchy-theme-dir "$theme")
|
||||
|
||||
theme_color() {
|
||||
local key="$1"
|
||||
|
||||
@@ -10,13 +10,7 @@ mkdir -p "$preview_dir"
|
||||
ln -s "$OMARCHY_PATH/default/plymouth/preview-unlock.png" "$preview_dir/default.png"
|
||||
|
||||
omarchy-plymouth-list | while read -r name; do
|
||||
if [[ -d ~/.config/omarchy/themes/$name ]]; then
|
||||
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
|
||||
ln -s "$(omarchy-theme-dir "$name")/preview-unlock.png" "$preview_dir/$name.png" 2>/dev/null
|
||||
done
|
||||
|
||||
current=$(omarchy-plymouth-current)
|
||||
|
||||
Executable
+18
@@ -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
|
||||
Reference in New Issue
Block a user