Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # <bitbar.title>Gmail Checker</bitbar.title>
- # <bitbar.version>v1.0</bitbar.version>
- # <bitbar.author>Nadav Cohen</bitbar.author>
- # <bitbar.author.github>nadavc</bitbar.author.github>
- # <bitbar.desc>Checks gmail and displays inbox count</bitbar.desc>
- USERNAME=<my gmail user>
- PASSWORD=<my gmail pass>
- RESULT=`curl -s -u $USERNAME:$PASSWORD "https://mail.google.com/mail/feed/atom" | egrep -o '<fullcount>[0-9]*' | cut -c 12-`
- if [ $RESULT -ne "0" ]; then
- if [ $RESULT -eq "1" ]; then
- MESSAGE="message"
- elif [ $RESULT -gt "1" ]; then
- MESSAGE="messages"
- fi
- ICON=📩
- NOTICE="$RESULT unread $MESSAGE"
- osascript -e "display notification "You have $NOTICE" with title "Email""
- else
- ICON=✉️
- NOTICE="No unread messages"
- fi
- echo $ICON "|size=14"
- echo "---"
- echo $NOTICE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement