Created
November 19, 2016 01:34
-
-
Save professorjamesmoriarty/6cc8d0d0a6217c55089b444ea0072cad to your computer and use it in GitHub Desktop.
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 | |
for msgid in $(notmuch search --output=messages tag:unread); do | |
msgjson=$(notmuch show --format=json --body=false --entire-thread=false "$msgid") | |
subject=$(echo "$msgjson" | jq 'recurse(.[]?) | .Subject? | select(length > 0)' -r) | |
sender=$(echo "$msgjson" | jq 'recurse(.[]?) | .From? | select(length > 0)' -r) | |
if echo "$sender" | grep -q '<'; then | |
sender=$(echo "$sender" | cut -d '<' -f2 | cut -d '>' -f1) | |
fi | |
notify-send "$sender" "$subject" -i /riddlebox/Dropbox/Photos/Icons/myicon70x70.png | |
done | |
num_mail="$(notmuch count tag:unread)" | |
if [ "$num_mail" -gt 0 ];then | |
aplay /riddlebox/Dropbox/Sounds/incoming.wav | |
fi | |
#notmuch tag -unnotified tag:unnotified |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment