diff --git a/bin/omarchy-plymouth-current b/bin/omarchy-plymouth-current index 6634d3e4..ea5e570f 100755 --- a/bin/omarchy-plymouth-current +++ b/bin/omarchy-plymouth-current @@ -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 diff --git a/bin/omarchy-plymouth-list b/bin/omarchy-plymouth-list index 9724d312..8841141b 100755 --- a/bin/omarchy-plymouth-list +++ b/bin/omarchy-plymouth-list @@ -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 diff --git a/bin/omarchy-plymouth-set-by-theme b/bin/omarchy-plymouth-set-by-theme index 95fccffc..0d577190 100755 --- a/bin/omarchy-plymouth-set-by-theme +++ b/bin/omarchy-plymouth-set-by-theme @@ -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" diff --git a/bin/omarchy-plymouth-switcher b/bin/omarchy-plymouth-switcher index f1a7bc8f..4c3ad2b1 100755 --- a/bin/omarchy-plymouth-switcher +++ b/bin/omarchy-plymouth-switcher @@ -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) diff --git a/bin/omarchy-theme-dir b/bin/omarchy-theme-dir new file mode 100755 index 00000000..83843c5a --- /dev/null +++ b/bin/omarchy-theme-dir @@ -0,0 +1,18 @@ +#!/bin/bash + +# omarchy:summary=Print the directory holding a theme, preferring a user-installed copy +# omarchy:args= +# omarchy:examples=omarchy theme dir tokyo-night + +theme="${1:-}" + +if [[ -z $theme ]]; then + echo "Usage: omarchy-theme-dir " >&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