mirror of
https://github.com/basecamp/omarchy.git
synced 2026-02-17 15:25:37 +00:00
Make an atomic swap of the theme directories
This commit is contained in:
@@ -7,6 +7,7 @@ fi
|
||||
|
||||
THEMES_DIR="$HOME/.config/omarchy/themes/"
|
||||
CURRENT_THEME_DIR="$HOME/.config/omarchy/current/theme"
|
||||
NEXT_THEME_DIR="$HOME/.config/omarchy/current/next-theme"
|
||||
|
||||
THEME_NAME=$(echo "$1" | sed -E 's/<[^>]+>//g' | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
|
||||
THEME_PATH="$THEMES_DIR/$THEME_NAME"
|
||||
@@ -16,16 +17,20 @@ if [[ ! -d "$THEME_PATH" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Setup clean theme directory
|
||||
rm -rf "$CURRENT_THEME_DIR"
|
||||
mkdir -p "$CURRENT_THEME_DIR"
|
||||
# Setup clean next theme directory
|
||||
rm -rf "$NEXT_THEME_DIR"
|
||||
mkdir -p "$NEXT_THEME_DIR"
|
||||
|
||||
# Copy static configs
|
||||
cp -r "$THEME_PATH/"* "$CURRENT_THEME_DIR/" 2>/dev/null
|
||||
cp -r "$THEME_PATH/"* "$NEXT_THEME_DIR/" 2>/dev/null
|
||||
|
||||
# Generate dynamic configs
|
||||
omarchy-theme-set-templates
|
||||
|
||||
# Swap next theme in as current
|
||||
rm -rf "$CURRENT_THEME_DIR"
|
||||
mv "$NEXT_THEME_DIR" "$CURRENT_THEME_DIR"
|
||||
|
||||
# Change background with theme
|
||||
omarchy-theme-bg-next
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
TEMPLATES_DIR="$OMARCHY_PATH/themes/templates.d"
|
||||
CURRENT_THEME_DIR="$HOME/.config/omarchy/current/theme"
|
||||
COLORS_FILE="$CURRENT_THEME_DIR/colors.toml"
|
||||
NEXT_THEME_DIR="$HOME/.config/omarchy/current/next-theme"
|
||||
COLORS_FILE="$NEXT_THEME_DIR/colors.toml"
|
||||
|
||||
# Only generate dynamic templates for themes with a colors.toml definition
|
||||
if [[ -f $COLORS_FILE ]]; then
|
||||
@@ -14,7 +14,7 @@ if [[ -f $COLORS_FILE ]]; then
|
||||
shopt -s nullglob
|
||||
for tpl in "$TEMPLATES_DIR"/*.tpl; do
|
||||
filename=$(basename "$tpl" .tpl)
|
||||
output_path="$CURRENT_THEME_DIR/$filename"
|
||||
output_path="$NEXT_THEME_DIR/$filename"
|
||||
|
||||
# Don't overwrite configs already exists in the output directory (copied from theme specific folder)
|
||||
if [[ ! -f $output_path ]]; then
|
||||
|
||||
Reference in New Issue
Block a user