2021-07-26 16:52:58 +02:00
|
|
|
#!/bin/bash
|
2021-06-19 15:50:04 +02:00
|
|
|
|
|
|
|
[ ! -e ~/.local/share/passwords ] && echo "no accounts configured" && exit 1
|
|
|
|
|
|
|
|
unread=0
|
2021-06-20 14:48:58 +02:00
|
|
|
for i in $(cat ~/.local/share/passwords); do
|
|
|
|
user=$(echo "$i" | awk -F':' '{print $1}')
|
|
|
|
pass=$(echo "$i" | awk -F':' '{print $2}')
|
|
|
|
count=$(curl -s --user "${user}:${pass}" https://mail.google.com/mail/feed/atom/ | grep -oPm1 "(?<=<title>)[^<]+" | sed '1d' | wc -l 2>/dev/null)
|
|
|
|
[ $count -ne 0 ] && export unread=$((unread + count))
|
2021-06-19 15:50:04 +02:00
|
|
|
if [ $user = 'ftpd@insomniac.pl' ]; then
|
2021-06-20 14:48:58 +02:00
|
|
|
count=$(curl -s --user "${user}:${pass}" https://mail.google.com/mail/feed/atom/sites | grep -oPm1 "(?<=<title>)[^<]+" | sed '1d' | wc -l 2>/dev/null)
|
|
|
|
[ $count -ne 0 ] && export unread=$((unread + count))
|
2021-06-19 15:50:04 +02:00
|
|
|
fi
|
|
|
|
done
|
2022-03-07 18:57:13 +01:00
|
|
|
[ "$unread" -eq 0 ] && printf "" || printf "^c#ffffff^^b#005577^\ue0e1 new mail: ${unread}^d^"
|