Added email checking and CLI notification
If there are more than 5 emails that are unread, an indicator will show up.
This commit is contained in:
parent
96fe0c41cf
commit
40b9b7031f
4 changed files with 27 additions and 5 deletions
16
launchd/com.joshtronic.checkemail.plist
Normal file
16
launchd/com.joshtronic.checkemail.plist
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>com.joshtronic.checkemail</string>
|
||||
<key>OnDemand</key>
|
||||
<true/>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/Users/josh/Source/dotfiles/scripts/check-email</string>
|
||||
</array>
|
||||
<key>StartInterval</key>
|
||||
<integer>300</integer>
|
||||
</dict>
|
||||
</plist>
|
2
scripts/check-email
Executable file
2
scripts/check-email
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
export KEYCHAIN_ITEM='email-gmail' && curl -u `security find-generic-password -s ${KEYCHAIN_ITEM} | grep 'acct' | cut -c 19- | tr -d '"' | tr -d '\n'`:`security find-generic-password -w -s ${KEYCHAIN_ITEM}` --silent "https://mail.google.com/mail/feed/atom" | perl -ne 'print "$2\n" if /<(email)>(.*)<\/\1>/;' | wc -l | tr -d ' ' > /tmp/UNREAD_GMAIL > /tmp/UNREAD_GMAIL
|
|
@ -14,14 +14,21 @@ function server()
|
|||
fi
|
||||
}
|
||||
|
||||
function unread_count()
|
||||
function unread_email()
|
||||
{
|
||||
unread=( $(</tmp/UNREAD_GMAIL) )
|
||||
|
||||
if [[ unread -ge 5 ]];
|
||||
then
|
||||
echo 📩
|
||||
fi
|
||||
}
|
||||
|
||||
USER="$(username)$(server)"
|
||||
PROMPT='
|
||||
%{$USER%}%{$fg[blue]%}%~ $(git_prompt_info)
|
||||
%{$FG[244]%}%# %{$reset_color%}'
|
||||
RPROMPT='$(unread_email)'
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
|
|
|
@ -192,8 +192,5 @@ fi
|
|||
# _update_brew_update
|
||||
# fi
|
||||
|
||||
### Added by the Heroku Toolbelt
|
||||
# Added by the Heroku Toolbelt
|
||||
export PATH="/usr/local/heroku/bin:$PATH"
|
||||
|
||||
echo ''
|
||||
fortune
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue