summaryrefslogtreecommitdiff
path: root/.config/eww/scripts/email-listener
blob: c2050253ca4089bae09d79d4ce00136cf58d75d1 (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
#!/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'
		;;
	*)
		printf '%d New Mails\n' $x
		;;
	esac
}

count
inotifywait -qm "$MAILDIR"/*/Inbox/new | while read _ event _
do
	case "$event" in
	CREATE|DELETE|MOVED_*)
		count
		;;
	esac
done
#''