mirror of
https://github.com/alrayyes/server-dotfiles
synced 2023-11-14 15:56:25 +00:00
added mail notification to bar
This commit is contained in:
parent
91253900b1
commit
2b0f7f425d
@ -28,6 +28,19 @@ command=/usr/lib/i3blocks/$BLOCK_NAME
|
|||||||
separator_block_width=15
|
separator_block_width=15
|
||||||
markup=none
|
markup=none
|
||||||
|
|
||||||
|
[mail_gmail]
|
||||||
|
command=~/.config/i3/i3blocks/gmail
|
||||||
|
label=G
|
||||||
|
instance=~/.i3mail/gmail
|
||||||
|
interval=60
|
||||||
|
separator=false
|
||||||
|
|
||||||
|
[mail_andthensome]
|
||||||
|
command=~/.config/i3/i3blocks/gmail
|
||||||
|
label=A
|
||||||
|
instance=~/.i3mail/andthensome
|
||||||
|
interval=60
|
||||||
|
|
||||||
# Music
|
# Music
|
||||||
[playerctl]
|
[playerctl]
|
||||||
command=~/.config/i3/vendor/i3blocks/blocks/playerctl
|
command=~/.config/i3/vendor/i3blocks/blocks/playerctl
|
||||||
|
25
i3/.config/i3/i3blocks/gmail
Executable file
25
i3/.config/i3/i3blocks/gmail
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
#!/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
|
Loading…
Reference in New Issue
Block a user