my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.5 KiB

3 years ago
  1. # Deprecate ZSH_THEME_RANDOM_BLACKLIST
  2. if [[ -n "$ZSH_THEME_RANDOM_BLACKLIST" ]]; then
  3. echo '[oh-my-zsh] ZSH_THEME_RANDOM_BLACKLIST is deprecated. Use `ZSH_THEME_RANDOM_IGNORED` instead.'
  4. ZSH_THEME_RANDOM_IGNORED=($ZSH_THEME_RANDOM_BLACKLIST)
  5. unset ZSH_THEME_RANDOM_BLACKLIST
  6. fi
  7. # Make themes a unique array
  8. typeset -Ua themes
  9. if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = array && ${#ZSH_THEME_RANDOM_CANDIDATES[@]} -gt 0 ]]; then
  10. # Use ZSH_THEME_RANDOM_CANDIDATES if properly defined
  11. themes=(${(@)ZSH_THEME_RANDOM_CANDIDATES:#random})
  12. else
  13. # Look for themes in $ZSH_CUSTOM and $ZSH and add only the theme name
  14. themes=(
  15. "$ZSH_CUSTOM"/*.zsh-theme(N:t:r)
  16. "$ZSH_CUSTOM"/themes/*.zsh-theme(N:t:r)
  17. "$ZSH"/themes/*.zsh-theme(N:t:r)
  18. )
  19. # Remove ignored themes from the list
  20. for theme in random ${ZSH_THEME_RANDOM_IGNORED[@]}; do
  21. themes=("${(@)themes:#$theme}")
  22. done
  23. fi
  24. # Choose a theme out of the pool of candidates
  25. N=${#themes[@]}
  26. (( N = (RANDOM%N) + 1 ))
  27. RANDOM_THEME="${themes[$N]}"
  28. unset N themes theme
  29. # Source theme
  30. if [[ -f "$ZSH_CUSTOM/$RANDOM_THEME.zsh-theme" ]]; then
  31. source "$ZSH_CUSTOM/$RANDOM_THEME.zsh-theme"
  32. elif [[ -f "$ZSH_CUSTOM/themes/$RANDOM_THEME.zsh-theme" ]]; then
  33. source "$ZSH_CUSTOM/themes/$RANDOM_THEME.zsh-theme"
  34. elif [[ -f "$ZSH/themes/$RANDOM_THEME.zsh-theme" ]]; then
  35. source "$ZSH/themes/$RANDOM_THEME.zsh-theme"
  36. else
  37. echo "[oh-my-zsh] Random theme '${RANDOM_THEME}' not found"
  38. return 1
  39. fi
  40. if [[ "$ZSH_THEME_RANDOM_QUIET" != true ]]; then
  41. echo "[oh-my-zsh] Random theme '${RANDOM_THEME}' loaded"
  42. fi