Attempt to templaterize the theme specific files

This commit is contained in:
David Heinemeier Hansson
2025-12-31 17:00:30 -07:00
parent 7fbc139cb5
commit 1cd2f5b979
179 changed files with 651 additions and 4352 deletions

View File

@@ -17,8 +17,34 @@ if [[ ! -d "$THEME_PATH" ]]; then
exit 1
fi
# Update theme symlinks
ln -nsf "$THEME_PATH" "$CURRENT_THEME_DIR"
# Prepare current theme directory (replacing symlink if it exists)
if [[ -L "$CURRENT_THEME_DIR" ]]; then
rm "$CURRENT_THEME_DIR"
elif [[ -d "$CURRENT_THEME_DIR" ]]; then
rm -rf "$CURRENT_THEME_DIR"
fi
mkdir -p "$CURRENT_THEME_DIR"
# Copy static assets (excluding templates, if any found in theme dir, though they shouldn't be there)
# We copy everything from the theme directory first.
cp -r "$THEME_PATH/"* "$CURRENT_THEME_DIR/" 2>/dev/null
# Generate configuration files from templates
TEMPLATES_DIR="$THEMES_DIR/templates.d"
COLORS_FILE="$THEME_PATH/colors.toml"
if [[ -x "$(command -v omarchy-theme-render)" ]]; then
omarchy-theme-render "$COLORS_FILE" "$TEMPLATES_DIR" "$CURRENT_THEME_DIR"
else
# Fallback to local script if not in PATH (development scenario)
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
if [[ -x "$SCRIPT_DIR/omarchy-theme-render" ]]; then
"$SCRIPT_DIR/omarchy-theme-render" "$COLORS_FILE" "$TEMPLATES_DIR" "$CURRENT_THEME_DIR"
else
echo "Error: omarchy-theme-render not found"
exit 1
fi
fi
# Change background with theme
omarchy-theme-bg-next