Super amazing animated gif prompt

We all like funny animated gifs, right?

We all like personalizing our shell prompts, right?

So lets do both!

Demo

demo

Requirements

Process

To speed up our prompt we will pre-process our animated gif (using the imgcat utility) into the format iTerm requires and save the output somwehere. I choose ~/.zsh/images/prompt.base64 or something similar.

imgcat /path/to/funny.gif > ~/.zsh/images/prompt.base64`

Update your prompt in your ~/.zshrc to cat out the preprocessed file to the display. Here is an example of mine:

animate_if_error()
{
  if [[ $? -ne 0 ]]; then
    PROMPT="$(cat ~/.zsh/images/prompt.base64)
$ "
  else
    PROMPT="$ "
  fi
}

precmd_functions+=animate_if_error

Now any time a command fails my prompt is updated with a hillarious animated gif (in reality, like all good zsh-ers my prompt is way more complex)