浏览代码

Merge pull request #48 from loweryaustin/macos-notifications

Add mac style notifications to mailsync script on "darwin" operating systems
tags/v3.1
Luke Smith 6 年前
committed by GitHub
父节点
当前提交
83e5e34ab3
找不到此签名对应的密钥 GPG 密钥 ID: 4AEE18F83AFDEB23
共有 1 个文件被更改,包括 18 次插入0 次删除
  1. +18
    -0
      etc/mailsync.sh

+ 18
- 0
etc/mailsync.sh 查看文件

@@ -26,3 +26,21 @@ new=$(find ~/.mail -wholename '*/new/*' | grep -vi "spam\|trash\|junk" | wc -l)
if [ "$new" -gt "$ori" ]; then
mpv --quiet ~/.config/mutt/etc/notify.opus
fi

for account in $(ls ~/.mail)
do
for mailbox in $(ls ~/.mail/$account/)
do
#List unread messages newer than last mailsync and count them
newcount=$(find ~/.mail/$account/$mailbox/new/ -type f -newer ~/.config/mutt/etc/mailsynclastrun 2> /dev/null | wc -l)
#Pop a Mac style notification with the count for that mailbox
if [ "$(uname)" == "Darwin" -a "$newcount" -gt "0" ]
then
osascript -e "display notification \"$newcount in $mailbox\" with title \"Youve got Mail\" subtitle \"Account: $account\""
sleep 2
fi
done
done

#Create a touch file that indicates the time of the last run of mailsync
touch ~/.config/mutt/etc/mailsynclastrun

正在加载...
取消
保存