Skip to content

Instantly share code, notes, and snippets.

@aMoniker
Last active March 28, 2018 23:22
Show Gist options
  • Save aMoniker/581545ac59d27be7e55c9eafbf77fd25 to your computer and use it in GitHub Desktop.
Save aMoniker/581545ac59d27be7e55c9eafbf77fd25 to your computer and use it in GitHub Desktop.
Dragon Prompt
# time-dragon.zsh-theme
THISFILE=${BASH_SOURCE:-$0}
DRAGON="πŸ‰"
DRAGON_SLEEP="πŸ²πŸ’€"
BED="πŸ› "
FIRE='πŸ”₯'
CLOCKFACES=( πŸ•› πŸ• πŸ•‘ πŸ•’ πŸ•“ πŸ•” πŸ•• πŸ•– πŸ•— πŸ•˜ πŸ•™ πŸ•š πŸ•› πŸ• πŸ•‘ πŸ•’ πŸ•“ πŸ•” πŸ•• πŸ•– πŸ•— πŸ•˜ πŸ•™ πŸ•š )
HOUR=`date +%H` # current hour
STARTHOUR=08 # first clock to show
ENDHOUR=19 # last clock to show
PROMPT_TOP=''
PROMPT_BOT=''
# If we're outside the bounds of the start/end hours, show the sleeping dragon
if [[ $HOUR -gt $ENDHOUR || $HOUR -lt $STARTHOUR ]]; then
PROMPT_TOP=$DRAGON_SLEEP
PROMPT_BOT=$BED
else
# otherwise, show the burned and remaining clocks
for i in `seq $STARTHOUR $ENDHOUR`; do
if [[ $i -lt $HOUR ]]; then
PROMPT_TOP="$PROMPT_TOP$FIRE"
else
PROMPT_TOP="$PROMPT_TOP$CLOCKFACES[$i + 1]"
fi
done
PROMPT_BOT=$DRAGON
fi
# Assemble the full prompt and assign it to the ZSH PROMPT var
PROMPT=$'\n$PROMPT_TOP $FG[032]%~%{$reset_color%}\n$PROMPT_BOT '
# Refresh the prompt every minute
periodic() {
source $THISFILE
}
PERIOD=60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment