summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/watch_mail19
1 files changed, 19 insertions, 0 deletions
diff --git a/bin/watch_mail b/bin/watch_mail
new file mode 100644
index 0000000..44c4a51
--- /dev/null
+++ b/bin/watch_mail
@@ -0,0 +1,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");
+}