emoji-clock.plugin.zsh 1.4 KB

1234567891011121314151617181920212223242526272829
  1. # ------------------------------------------------------------------------------
  2. # FILE: emoji-clock.plugin.zsh
  3. # DESCRIPTION: The current time with half hour accuracy as an emoji symbol.
  4. # Inspired by Andre Torrez' "Put A Burger In Your Shell"
  5. # http://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html
  6. # AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
  7. # VERSION: 1.0.0
  8. # -----------------------------------------------------------------------------
  9. function emoji-clock() {
  10. hour=$(date -v '+15M' '+%I')
  11. minutes=$(date -v '+15M' '+%M')
  12. case $hour in
  13. 01) clock="🕐"; [ $minutes -ge 30 ] && clock="🕜";;
  14. 02) clock="🕑"; [ $minutes -ge 30 ] && clock="🕝";;
  15. 03) clock="🕒"; [ $minutes -ge 30 ] && clock="🕞";;
  16. 04) clock="🕓"; [ $minutes -ge 30 ] && clock="🕟";;
  17. 05) clock="🕔"; [ $minutes -ge 30 ] && clock="🕠";;
  18. 06) clock="🕕"; [ $minutes -ge 30 ] && clock="🕡";;
  19. 07) clock="🕖"; [ $minutes -ge 30 ] && clock="đŸ•ĸ";;
  20. 08) clock="🕗"; [ $minutes -ge 30 ] && clock="đŸ•Ŗ";;
  21. 09) clock="🕘"; [ $minutes -ge 30 ] && clock="🕤";;
  22. 10) clock="🕙"; [ $minutes -ge 30 ] && clock="đŸ•Ĩ";;
  23. 11) clock="🕚"; [ $minutes -ge 30 ] && clock="đŸ•Ļ";;
  24. 12) clock="🕛"; [ $minutes -ge 30 ] && clock="🕧";;
  25. *) clock="⌛";;
  26. esac
  27. echo $clock
  28. }