Extract theme-list and theme-set so they can be used more easily in any menu

This commit is contained in:
David Heinemeier Hansson
2025-08-04 19:44:42 +02:00
parent 552fbb47fe
commit 7e84755c75
3 changed files with 25 additions and 31 deletions

21
bin/omarchy-theme-list Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
THEMES_DIR="$HOME/.config/omarchy/themes/"
CURRENT_THEME_DIR="$HOME/.config/omarchy/current/theme"
CURRENT_THEME_NAME=$(basename "$(realpath "$CURRENT_THEME_DIR")")
# Build themes list with pretty display names
mapfile -t themes < <(
find "$THEMES_DIR" -mindepth 1 -maxdepth 1 \( -type d -o -type l \) | sort | while read -r path; do
filename=$(basename "$path")
display_name=$(echo "$filename" | sed -E 's/(^|-)([a-z])/\1\u\2/g; s/-/ /g')
if [[ "$filename" == "$CURRENT_THEME_NAME" ]]; then
echo "<i>$display_name</i>"
else
echo "$display_name"
fi
done
)
printf '%s\n' "${themes[@]}"