Commit 78608102 authored by uoou's avatar uoou
Browse files

function

parent 59553a08
......@@ -7,7 +7,7 @@ maildir="$HOME/.mail/posteo/Inbox/new/"
limit=600
# no new mails
if [[ $(ls -t1 "$maildir" | wc -l) -lt 1 ]];then
if [[ "$(ls -t1 $maildir | wc -l)" -lt 1 ]];then
exit 0
fi
......@@ -19,10 +19,10 @@ fi
echo -e "$(date +%s)\n$(ls -1 $maildir | tail -n1)" > /tmp/lastding
for i in "$maildir"*;do
from="$(cat $i | sed -nE '/^From:|^Subject:/p')"
from="$(cat $i | sed -nE '/^From:|^Subject:/p' | sed 's/<.*@.*\..*>$//')"
text=$from"\n\n$text"
done
text="$(ls -1 $maildir | wc -l) new mail:\n\n$text"
text="$(ls -1 $maildir | wc -l)\n\n$text"
notify-send "$(echo -e "$text" | head -n-2)" & /home/drew/.local/bin/ding
#!/usr/bin/env bash
nummails=$(ls /home/drew/.mail/posteo/Inbox/new/ | wc -l)
text=""
if [ $nummails -ge 1 ];then
if [ -f /tmp/lastmail ];then
lastmail=$(cat /tmp/lastmail | head -n 1)
count=$(cat /tmp/lastmail | tail -n 1)
else
lastmail=""
count=0
fi
count=$((count+1))
newmail=$(ls -t1 /home/drew/.mail/posteo/Inbox/new/ | head -n 1)
echo "$newmail" > /tmp/lastmail
echo "$count" >> /tmp/lastmail
if [ "$newmail" != "$lastmail" ] || [ $count -ge 10 ];then
count=0
echo "$newmail" > /tmp/lastmail
echo "$count" >> /tmp/lastmail
text="$nummails new mail(s)
"
if [ $nummails -gt 1 ];then
text=$text"Most recent:
"
fi
text=$text$(cat /home/drew/.mail/posteo/Inbox/new/$(ls -t1 /home/drew/.mail/posteo/Inbox/new/ | head -n 1) | grep -E 'From: |Subject: ')
notify-send "$text" & /home/drew/.local/bin/ding
fi
fi
......@@ -89,7 +89,7 @@ macro index,pager Ct "<copy-message>=Trash<enter>" "copy mail to trash"
set mailcap_path = /home/drew/.config/mutt/mailcap
set date_format="%d %b, %H:%M"
set display_filter = "/home/drew/.local/bin/emaildates" # format times as local
#set display_filter = "/home/drew/.local/bin/emaildates" # format times as local
set index_format="%5C %-60.60s %-50.50F %> %D %zs %?X?A& ?"
set query_command = "abook --mutt-query '%s'"
set rfc2047_parameters = yes
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment