#!/bin/bash export DISPLAY=:0 CHECK_FILE="/home/pavel/Mail/.last_check" QUERY="tag:unread" ALL_QUERY="tag:unread" if [ -f "$CHECK_FILE" ]; then DATE=$(cat "$CHECK_FILE") QUERY="$QUERY and date:@$DATE.." fi notmuch new NEW_UNREAD=$(notmuch count "$QUERY") ALL_UNREAD=$(notmuch count "$ALL_QUERY") if [ $NEW_UNREAD -gt 0 ]; then MAIN_UNREAD=$(notmuch count "tag:unread AND tag:main") PROGIN_UNREAD=$(notmuch count "tag:unread AND tag:progin") read -r -d '' NOTIFICATION < $CHECK_FILE