blob: 71748a7b028835aa53bd9213a8d1e2075302619c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#!/bin/sh
count()
{
x=`find "$MAILDIR"/*/Inbox/new -type f | wc -l`
case $x in
0)
echo 'No New Mail'
;;
1)
echo '1 New Mail'
cnt='There is 1 new email'
;;
*)
printf '%d New Mails\n' $x
cnt="There are $x new emails"
;;
esac
[ $x -gt ${prev:=0} ] && notify-send -a email -u normal 'New Email' \
"A new unread email has been recieved. $cnt."
prev=$x
}
count
inotifywait -qm "$MAILDIR"/*/Inbox/new | while read _ event _
do
case "$event" in
CREATE|DELETE|MOVED_*)
count
;;
esac
done
#''
|