mirror of
https://github.com/alrayyes/i3blocks
synced 2023-11-13 18:16:40 +00:00
26 lines
610 B
Plaintext
26 lines
610 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
# Requires https://www.google.com/settings/security/lesssecureapps for gmail.
|
||
|
|
||
|
CONFIG_FILE="${BLOCK_INSTANCE}"
|
||
|
CONFIG_FILE=${CONFIG_FILE/\~/$HOME}
|
||
|
|
||
|
# Config file needs the following settings:
|
||
|
#MAIL_USER="user@domain.tld"
|
||
|
#MAIL_PASSWORD="secret"
|
||
|
|
||
|
if [[ ! -f "${CONFIG_FILE}" ]]; then
|
||
|
echo "${CONFIG_FILE}"
|
||
|
exit 33
|
||
|
fi
|
||
|
|
||
|
source "${CONFIG_FILE}"
|
||
|
|
||
|
COUNT=`curl -su $MAIL_USER:$MAIL_PASSWORD https://mail.google.com/mail/feed/atom || echo "<fullcount>unknown number of</fullcount>"`
|
||
|
COUNT=`echo "$COUNT" | grep -oPm1 "(?<=<fullcount>)[^<]+" `
|
||
|
if [ "$COUNT" = "0" ]; then
|
||
|
echo ""
|
||
|
else
|
||
|
echo $COUNT
|
||
|
fi
|