summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-02-13 16:41:58 -0500
committerJesse Luehrs <doy@tozt.net>2022-02-13 16:45:01 -0500
commite28f696301ce9457699a9d6d466fae17de90b695 (patch)
tree3fb66ba4f8e36a320b444fcf898b80153039b755
parent53667b15f894f4c6d6c822248567584ce9b8410c (diff)
downloadconf-e28f696301ce9457699a9d6d466fae17de90b695.tar.gz
conf-e28f696301ce9457699a9d6d466fae17de90b695.zip
allow SIGHUP to immediately recheck mail
-rwxr-xr-xbin/mbsyncloop3
-rw-r--r--mutt/local2
2 files changed, 4 insertions, 1 deletions
diff --git a/bin/mbsyncloop b/bin/mbsyncloop
index fba66fd..a127fea 100755
--- a/bin/mbsyncloop
+++ b/bin/mbsyncloop
@@ -56,6 +56,7 @@ if (!$pw_pid) {
}
my $last_all = 0;
+$SIG{HUP} = sub { $last_all = 0 };
while (1) {
my $now = time;
if (($now - $last_all) >= 14 * 60) {
@@ -84,10 +85,12 @@ sub idle {
my $rin = '';
vec($rin, fileno($goimapnotify_r), 1) = 1;
my $ready = select(my $rout = $rin, undef, undef, $max_delay);
+ return 0 if $ready == -1 && $! == POSIX::EINTR;
die "failed to read goimapnotify output: $!" if $ready == -1;
if ($ready) {
while (1) {
my $ready = select(my $rout = $rin, undef, undef, 0.01);
+ return 0 if $ready == -1 && $! == POSIX::EINTR;
die "failed to read goimapnotify output: $!" if $ready == -1;
last unless $ready;
sysread $goimapnotify_r, my $data, 4096;
diff --git a/mutt/local b/mutt/local
index 0d6205f..a4fea33 100644
--- a/mutt/local
+++ b/mutt/local
@@ -10,7 +10,7 @@ mailboxes `\
echo -n "\"=$basename\" ";\
fi\
done`
-macro index R "<enter-command>unset wait_key<enter><shell-escape>mbsync all && notmuch new<enter><enter-command>set wait_key<enter>" "fetch mail with mbsync"
+macro index R "<enter-command>unset wait_key<enter><shell-escape>svc -h ~/.services/enabled/mbsyncloop<enter><enter-command>set wait_key<enter>" "fetch mail with mbsync"
set timeout=3
# vim: ft=neomuttrc