mirror of
https://github.com/basecamp/omarchy.git
synced 2026-02-17 15:25:37 +00:00
Use theme config templates with singular color definition (#4053)
* Attempt to templaterize the theme specific files * Cleanup * Slim down * Combine render into -set * Pull out the dynamic template rendering again, but simpler * Fix vars * Variables are lowercase * Better presentation * Fix missing colors * Provide stripped values too * Fix colors for regular hex format * Bring back explicit btop themes They're too involved to derive from a basic color set * Make an atomic swap of the theme directories * No longer used by walker to cancel * Explain why * Remove redundant const * Consistent const naming * No longe have $THEMES_DIR * Correct the blue * Set opencode colors too * Fix colors for readability * Move the templates together with the others in default * Split user themes and default themes * Fix paths * Look for both user themes and default themes Plus speed things up * Migrate to the new setup where default themes live inside omarchy * Explicitly store the name of the current theme * Cleanup * No longer need omarchy-theme-next since themes are now fully rendered, not symlinks * Get current theme name from the new theme.name file * Look for user background images in dedicated directory * Need yq for toml * Need yq to parse colors.toml * Look for backgrounds matching the new theme.name We no longer have symlinks * Migrate existing user backgrounds to the new proper location * Install user backgrounds in the correct path * Fix quoting * Just rely on the system theme for opencode and get ready for USRSIG2 being available to live reload * Fix template generation for rgb colors
This commit is contained in:
committed by
GitHub
parent
de2757466b
commit
4a07b94cb6
@@ -1,24 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -z $1 && $1 != "CNCLD" ]]; then
|
||||
if [[ -z $1 ]]; then
|
||||
echo "Usage: omarchy-theme-set <theme-name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
THEMES_DIR="$HOME/.config/omarchy/themes/"
|
||||
CURRENT_THEME_DIR="$HOME/.config/omarchy/current/theme"
|
||||
CURRENT_THEME_PATH="$HOME/.config/omarchy/current/theme"
|
||||
NEXT_THEME_PATH="$HOME/.config/omarchy/current/next-theme"
|
||||
USER_THEMES_PATH="$HOME/.config/omarchy/themes"
|
||||
OMARCHY_THEMES_PATH="$OMARCHY_PATH/themes"
|
||||
|
||||
THEME_NAME=$(echo "$1" | sed -E 's/<[^>]+>//g' | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
|
||||
THEME_PATH="$THEMES_DIR/$THEME_NAME"
|
||||
|
||||
# Check if the theme entered exists
|
||||
if [[ ! -d "$THEME_PATH" ]]; then
|
||||
echo "Theme '$THEME_NAME' does not exist in $THEMES_DIR"
|
||||
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
|
||||
echo "Theme '$THEME_NAME' does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Update theme symlinks
|
||||
ln -nsf "$THEME_PATH" "$CURRENT_THEME_DIR"
|
||||
# Setup clean next theme directory (for atomic theme config swapping)
|
||||
rm -rf "$NEXT_THEME_PATH"
|
||||
mkdir -p "$NEXT_THEME_PATH"
|
||||
|
||||
# Copy static configs
|
||||
cp -r "$THEME_PATH/"* "$NEXT_THEME_PATH/" 2>/dev/null
|
||||
|
||||
# Generate dynamic configs
|
||||
omarchy-theme-set-templates
|
||||
|
||||
# Swap next theme in as current
|
||||
rm -rf "$CURRENT_THEME_PATH"
|
||||
mv "$NEXT_THEME_PATH" "$CURRENT_THEME_PATH"
|
||||
|
||||
# Store theme name for reference
|
||||
echo "$THEME_NAME" > "$HOME/.config/omarchy/current/theme.name"
|
||||
|
||||
# Change background with theme
|
||||
omarchy-theme-bg-next
|
||||
@@ -31,9 +49,10 @@ omarchy-restart-swayosd
|
||||
omarchy-restart-terminal
|
||||
hyprctl reload
|
||||
pkill -SIGUSR2 btop
|
||||
# pkill -SIGUSR2 opencode
|
||||
makoctl reload
|
||||
|
||||
# Change gnome, browser, vscode, cursor themes
|
||||
# Change app-specific themes
|
||||
omarchy-theme-set-gnome
|
||||
omarchy-theme-set-browser
|
||||
omarchy-theme-set-vscode
|
||||
|
||||
Reference in New Issue
Block a user