notify system added
This commit is contained in:
23
etc/mailsync.sh
Executable file
23
etc/mailsync.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
# This script will run offlineimap and check
|
||||
# for new email if there is an internet connection.
|
||||
#
|
||||
# If it detects new mail, it uses mpv to play a
|
||||
# notification sound: notify.opus
|
||||
#
|
||||
# I have this run as a cronjob every 5 minutes.
|
||||
|
||||
# Check for internet connection. Exit script if none.
|
||||
ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` >/dev/null || exit
|
||||
|
||||
# Get current number of new mail, then begin sync.
|
||||
ori=$(find ~/.mail -wholename '*/new/*' | grep /new/ | grep -vi "spam\|trash\|junk" | wc -l)
|
||||
offlineimap -o
|
||||
|
||||
# Output new new mail count.
|
||||
new=$(find ~/.mail -wholename '*/new/*' | grep /new/ | grep -vi "spam\|trash\|junk" | wc -l)
|
||||
|
||||
# If new mail has grown, play a notification.
|
||||
if [ "$new" -gt "$ori" ]; then
|
||||
mpv --quiet ~/.config/mutt/etc/notify.opus
|
||||
fi
|
BIN
etc/notify.opus
Normal file
BIN
etc/notify.opus
Normal file
Binary file not shown.
Reference in New Issue
Block a user