mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Refactor loading of theme into function for reusability
- Make sure to load a new theme after user 'unlikes' a theme
This commit is contained in:
parent
899d9d5ab3
commit
4a052e88df
2 changed files with 23 additions and 22 deletions
24
oh-my-zsh.sh
24
oh-my-zsh.sh
|
|
@ -33,27 +33,13 @@ done
|
|||
# Load all of your custom configurations from custom/
|
||||
for config_file ($ZSH/custom/*.zsh) source $config_file
|
||||
|
||||
export FAVORITE_THEMES_DIR="$ZSH/themes/favorites/"
|
||||
# Allow users to randomize themes with only their favorites
|
||||
if [ ! -d $FAVORITE_THEMES_DIR ]; then
|
||||
mkdir $FAVORITE_THEMES_DIR
|
||||
fi
|
||||
|
||||
# Load the theme
|
||||
# Check for updates on initial load...
|
||||
if [ "$ZSH_THEME" = "random" ]; then
|
||||
load_random_theme
|
||||
elif [ "$ZSH_THEME" = "favorites" ]; then
|
||||
# Only randomize with liked themes if there are any
|
||||
if [ `ls $FAVORITE_THEMES_DIR | wc -w` -gt 0 ]; then
|
||||
load_random_theme $FAVORITE_THEMES_DIR/*zsh-theme
|
||||
else
|
||||
load_random_theme
|
||||
fi
|
||||
else
|
||||
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
|
||||
# Allow users to randomize themes with only their favorites
|
||||
if [ ! -d $FAVORITE_THEMES_DIR ]; then
|
||||
mkdir $FAVORITE_THEMES_DIR
|
||||
fi
|
||||
|
||||
# Load theme (random/favorite/specific)
|
||||
load_theme
|
||||
|
||||
# Check for updates on initial load...
|
||||
if [ "$DISABLE_AUTO_UPDATE" = "true" ]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue