summaryrefslogtreecommitdiffstats
path: root/bin/watch_mail
blob: 44c4a519f15fd240534ed4d183829a388ab3d835 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env perl
use strict;
use warnings;
use 5.014;

use Linux::Inotify2;

my $inotify = Linux::Inotify2->new;
for my $dir (`find $ENV{HOME}/Maildir -name cur`) {
    chomp $dir;
    $inotify->watch($dir, IN_MODIFY|IN_MOVED_TO|IN_CREATE|IN_DELETE);
}

$inotify->blocking(1);

while (1) {
    my @e = $inotify->read;
    system("notmuch new > /dev/null 2>&1");
}