19 lines
444 B
Bash
19 lines
444 B
Bash
#!/bin/sh
|
|
|
|
check() {
|
|
[ ! -d "$HOME/.mail" ] && return
|
|
|
|
notmuch new > /dev/null
|
|
count="$(notmuch count 'tag:unread')"
|
|
tooltip="There are $count new emails"
|
|
if [ "$count" = "0" ]; then
|
|
printf '{"text": ""}\n'
|
|
else
|
|
printf '{"text": "%s", "tooltip": "%s", "alt": "icon"}\n' "$count" "$tooltip"
|
|
fi
|
|
inotifywait -q -e move -e create -e delete "$HOME/.mail/cnst/INBOX/cur" > /dev/null
|
|
check
|
|
}
|
|
|
|
check
|