123456789101112131415161718192021222324252627282930313233 |
- # ------------------------------------------------------------------------------
- # FILE: emoji-clock.plugin.zsh
- # DESCRIPTION: The current time with half hour accuracy as an emoji symbol.
- # Inspired by Andre Torrez' "Put A Burger In Your Shell"
- # https://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html
- # AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
- # VERSION: 1.0.0
- # -----------------------------------------------------------------------------
- function emoji-clock() {
- # Add 15 minutes to the current time and save the value as $minutes.
- (( minutes = $(date '+%M') + 15 ))
- (( hour = $(date '+%I') + minutes / 60 ))
- # make sure minutes and hours don't exceed 60 nor 12 respectively
- (( minutes %= 60 )); (( hour %= 12 ))
- case $hour in
- 0) clock="đ"; [ $minutes -ge 30 ] && clock="đ§";;
- 1) clock="đ"; [ $minutes -ge 30 ] && clock="đ";;
- 2) clock="đ"; [ $minutes -ge 30 ] && clock="đ";;
- 3) clock="đ"; [ $minutes -ge 30 ] && clock="đ";;
- 4) clock="đ"; [ $minutes -ge 30 ] && clock="đ";;
- 5) clock="đ"; [ $minutes -ge 30 ] && clock="đ ";;
- 6) clock="đ"; [ $minutes -ge 30 ] && clock="đĄ";;
- 7) clock="đ"; [ $minutes -ge 30 ] && clock="đĸ";;
- 8) clock="đ"; [ $minutes -ge 30 ] && clock="đŖ";;
- 9) clock="đ"; [ $minutes -ge 30 ] && clock="đ¤";;
- 10) clock="đ"; [ $minutes -ge 30 ] && clock="đĨ";;
- 11) clock="đ"; [ $minutes -ge 30 ] && clock="đĻ";;
- *) clock="â";;
- esac
- echo $clock
- }
|