Allow user themes to override individual files from official themes (#4547)

Instead of choosing exclusively between the official or user theme
directory, copy the official theme first, then overlay any user
customizations on top. This allows users to override specific files
(e.g. colors, backgrounds, keyboard backlight) without having to
duplicate the entire theme.
This commit is contained in:
Tommy Martin
2026-02-18 22:07:49 +01:00
committed by GitHub
parent 73dc11286b
commit eec15803fc
+4 -7
View File
@@ -12,11 +12,7 @@ OMARCHY_THEMES_PATH="$OMARCHY_PATH/themes"
THEME_NAME=$(echo "$1" | sed -E 's/<[^>]+>//g' | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
if [[ -d "$USER_THEMES_PATH/$THEME_NAME" ]]; then
THEME_PATH="$USER_THEMES_PATH/$THEME_NAME"
elif [[ -d "$OMARCHY_THEMES_PATH/$THEME_NAME" ]]; then
THEME_PATH="$OMARCHY_THEMES_PATH/$THEME_NAME"
else
if [[ ! -d "$OMARCHY_THEMES_PATH/$THEME_NAME" ]] && [[ ! -d "$USER_THEMES_PATH/$THEME_NAME" ]]; then
echo "Theme '$THEME_NAME' does not exist"
exit 1
fi
@@ -25,8 +21,9 @@ fi
rm -rf "$NEXT_THEME_PATH"
mkdir -p "$NEXT_THEME_PATH"
# Copy static configs
cp -r "$THEME_PATH/"* "$NEXT_THEME_PATH/" 2>/dev/null
# Copy official theme first, then overlay user customizations on top
cp -r "$OMARCHY_THEMES_PATH/$THEME_NAME/"* "$NEXT_THEME_PATH/" 2>/dev/null
cp -r "$USER_THEMES_PATH/$THEME_NAME/"* "$NEXT_THEME_PATH/" 2>/dev/null
# Generate dynamic configs
omarchy-theme-set-templates