helm/os/arch/.config/panel/lemons/mail.sh
2016-11-03 00:58:47 +01:00

24 lines
594 B
Bash
Executable file

#!/usr/bin/env bash
[ -f ~/.secrets/accounts.sh ] && . ~/.secrets/accounts.sh || exit
feed=$(curl -u "${MAIL_USER}:${MAIL_PASS}" --silent https://mail.google.com/mail/feed/atom)
con=$(echo $feed | grep -c "<fullcount>")
num=$(echo $feed | grep -o "<entry>" | wc -l)
if [ "$con" -eq 1 ]
then
# if [ "$num" -gt 0 ]; then
# oldnum=0
# [ -f /tmp/newmail ] && oldnum=$(cat /tmp/newmail)
# echo "$num" > /tmp/newmail
# if [ "$num" -ne "$oldnum" ]
# then
# notify-send 'New email'
# fi
# fi
echo "M$num"
else
echo "M!"
fi