Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading random theme from list of themes #4647

Closed
cuonglm opened this issue Nov 30, 2015 · 13 comments
Closed

Loading random theme from list of themes #4647

cuonglm opened this issue Nov 30, 2015 · 13 comments

Comments

@cuonglm
Copy link
Contributor

cuonglm commented Nov 30, 2015

Currently, oh-my-zsh only allow user to load a specified theme or a random theme from all available theme.

From user perspective, it can make some inconvenience, because some themes setting is not available in user system by default. Example with adben theme, I always get:

ps1_fortune:2: command not found: fortune

It would be better if user can chose which set of themes they want to load:

ZSH_THEME=( robbyrussell fino agnoster )

will make zsh load one of three themes in each session.

If you guys agree with this feature, I will go with a pull request.

@apjanke
Copy link
Contributor

apjanke commented Nov 30, 2015

Sounds useful.

Instead of introducing an alternate list form of $ZSH_THEME itself, it might be easier in terms of implementation to add a separate variable like $ZSH_THEME_RANDOM_CANDIDATES that modifies the behavior of ZSH_THEME=random. Like #3703 does for implementing the converse of this, excluding particular themes from the random selection. #3743 also has some pending changes that add random and blacklist support to the theme() function that could incorporate this as well.

@cuonglm
Copy link
Contributor Author

cuonglm commented Dec 1, 2015

@apjanke Good point, implement a separate variable is better.

I make an attempt in this commit.

@cuonglm
Copy link
Contributor Author

cuonglm commented Dec 18, 2015

@apjanke Would you please looking in the commit above :)

@apjanke
Copy link
Contributor

apjanke commented Dec 18, 2015

I left a note on minor spelling and syntax. Otherwise looks good. Make it a PR and I'll test it out.

@rob-mcgrail
Copy link

If anyone just wants to add this to their .zshrc in the meantime, add:

    ZSH_THEME_RANDOM_CANDIDATES=( jtriley simple sorin fino agnoster jispwoso tjkirch macovsky ys wezm theunraveler sunrise funky cloud bureau agnoster wezm+ )

    if [ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = "array" ] && [ "${#ZSH_THEME_RANDOM_CANDIDATES[@]}" -gt 0 ]; then
      themes=(${^ZSH_THEME_RANDOM_CANDIDATES})
      N=${#themes[@]}
      ((N=(RANDOM%N)+1))
      ZSH_THEME=${themes[$N]}
      echo $ZSH_THEME
    fi

    source $ZSH/oh-my-zsh.sh

@cuonglm
Copy link
Contributor Author

cuonglm commented Feb 29, 2016

@roboMC I still use my branch in local to enable this feature, not sure when this will be pushed to the master.

Any ideal @apjanke?

@danhimalplanet
Copy link
Contributor

Any progress on merging this to master? This would be really useful for Linux stuff that doesn't work in OSX, for OSX stuff that doesn't work in Linux.

@ctf0
Copy link

ctf0 commented Aug 12, 2016

#3271 fixed for me but the fortune shoul be optional depend if the package is installed or not, pushing the user to instal it is bad experiance.

@cuonglm
Copy link
Contributor Author

cuonglm commented Aug 12, 2016

@ctf0 We need to wait #3743 to be merged, no ETA at all

@apjanke
Copy link
Contributor

apjanke commented Aug 12, 2016

the fortune shoul be optional depend if the package is installed or not, pushing the user to instal it is bad experiance.

Agreed. It should make the fortune element conditional. I'd consider that a bug in the individual theme using fortune. You can submit a separate PR to fix it, or we'll get around to it eventually.

@ctf0
Copy link

ctf0 commented Aug 12, 2016

@Gnouc with the current huge number of PRs , and having the @apjanke fix made like a year a go , i wouldn't hold high hopes on that 😞

@nicolaisueper
Copy link

This isn't a topic anymore?

@robbyrussell
Copy link
Member

Merged #4711 today!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants