Fix theme switcher to work with real directories in .config/omarchy/themes

Not just symlinks
This commit is contained in:
David Heinemeier Hansson
2025-07-11 08:57:55 -07:00
parent a6f4c1d68b
commit 2d5285fc56

View File

@ -3,20 +3,22 @@
THEMES_DIR="$HOME/.config/omarchy/themes/" THEMES_DIR="$HOME/.config/omarchy/themes/"
CURRENT_THEME_LINK="$HOME/.config/omarchy/current/theme" CURRENT_THEME_LINK="$HOME/.config/omarchy/current/theme"
THEMES=($(find "$THEMES_DIR" -mindepth 1 | sort)) THEMES=($(find "$THEMES_DIR" -mindepth 1 -maxdepth 1 | sort))
TOTAL=${#THEMES[@]} TOTAL=${#THEMES[@]}
# Get current theme from symlink # Get current theme from symlink
if [[ -L "$CURRENT_THEME_LINK" ]]; then if [[ -L "$CURRENT_THEME_LINK" ]]; then
CURRENT_THEME=$(readlink "$CURRENT_THEME_LINK") CURRENT_THEME=$(realpath "$CURRENT_THEME_LINK")
else else
# Default to first theme if no symlink exists # Default to first theme if no symlink exists
CURRENT_THEME=${THEMES[0]} CURRENT_THEME=$(realpath "${THEMES[0]}")
fi fi
# Find current theme index # Find current theme index
INDEX=0 INDEX=0
for i in "${!THEMES[@]}"; do for i in "${!THEMES[@]}"; do
THEMES[$i]=$(realpath "${THEMES[$i]}")
if [[ "${THEMES[$i]}" == "$CURRENT_THEME" ]]; then if [[ "${THEMES[$i]}" == "$CURRENT_THEME" ]]; then
INDEX=$i INDEX=$i
break break