Last active
April 27, 2024 06:22
-
-
Save cirrusUK/23d989ac83cbbbced1cebd1eb6d2ba0c to your computer and use it in GitHub Desktop.
script to show gmail inbox notifications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # script to show gmail inbox notifications | |
| # ------------------------------------------------------------------------------# | |
| # 1. Edit Line 12: USERNAME:[email protected]/mail/feed/atom \ # | |
| # 2. Choose which notification you would like by commenting out line 15 or 16 # | |
| # 3. Edit icon path & Download Gmail icon: https://transfer.sh/RXLDF/gmail2.png # # | |
| # 4. Include it into user crontab table with crontab -e # | |
| # I.E */15 * * * * /home/user/.scripts/gmail-notify.sh # every 15 minutes # | |
| # # | |
| # ------------------------------------------------------------------------------# | |
| export DISPLAY=":0.0" | |
| MAIL=$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -v -O - \ | |
| https://USERNAME:[email protected]/mail/feed/atom \ | |
| --no-check-certificate | grep 'fullcount' \ | |
| | sed -e 's/.*<fullcount>//;s/<\/fullcount>.*//' 2>/dev/null) | |
| notify-send -h string:bgcolor:#191919 -h string:fgcolor:#008f77 -i ~/.icons/gmail2.png "Inbox" "$MAIL" | |
| # xcowsay --at 3100,40 --font=Cantarell --time=10 --monitor=1 --image ~/.icons/gmail2.png "Inbox" "$MAIL" | |
| exit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # shows title(s) of emails in gmail inbox | |
| # edit lines 10 & 11 | |
| red=`tput setaf 1` | |
| bold=`tput bold` | |
| tput setaf 1 | |
| tput bold | |
| printf "\e[1;32m📧 \e[0;31m📧 \e[0;33m📧 \e[1;37mGmail Inbox \e[0;34m📧 \e[0;36m📧 \e[0;35m📧 \e[0m" | |
| username="[email protected]" | |
| password="PASSWORD" | |
| echo | |
| curl -u $username:$password --silent "https://mail.google.com/mail/feed/atom" | grep -oPm1 "(?<=<title>)[^<]+" | sed '1d' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| export DISPLAY=":0.0" | |
| INBOX=$(/path/to/above/script/inbox) | |
| xcowsay --at 3100,20 --font=PragmataPro --time=10 --monitor=1 --image ~/.icons/gmail2.png "$INBOX" | |
| exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment