Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # <bitbar.title>Gmail Checker</bitbar.title>
  4. # <bitbar.version>v1.0</bitbar.version>
  5. # <bitbar.author>Nadav Cohen</bitbar.author>
  6. # <bitbar.author.github>nadavc</bitbar.author.github>
  7. # <bitbar.desc>Checks gmail and displays inbox count</bitbar.desc>
  8.  
  9. USERNAME=<my gmail user>
  10. PASSWORD=<my gmail pass>
  11. RESULT=`curl -s -u $USERNAME:$PASSWORD "https://mail.google.com/mail/feed/atom" | egrep -o '<fullcount>[0-9]*' | cut -c 12-`
  12.  
  13. if [ $RESULT -ne "0" ]; then
  14. if [ $RESULT -eq "1" ]; then
  15. MESSAGE="message"
  16. elif [ $RESULT -gt "1" ]; then
  17. MESSAGE="messages"
  18. fi
  19. ICON=📩
  20. NOTICE="$RESULT unread $MESSAGE"
  21. osascript -e "display notification "You have $NOTICE" with title "Email""
  22. else
  23. ICON=✉️
  24. NOTICE="No unread messages"
  25. fi
  26.  
  27. echo $ICON "|size=14"
  28. echo "---"
  29. echo $NOTICE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement