about summary refs log tree commit diff stats
path: root/worker/notmuch/worker.go
diff options
context:
space:
mode:
Diffstat (limited to 'worker/notmuch/worker.go')
-rw-r--r--worker/notmuch/worker.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go
index 7480124..dfcfa77 100644
--- a/worker/notmuch/worker.go
+++ b/worker/notmuch/worker.go
@@ -9,6 +9,7 @@ import (
 	"os"
 	"path/filepath"
 	"strings"
+	"time"
 
 	"git.sr.ht/~sircmpwn/aerc/config"
 	"git.sr.ht/~sircmpwn/aerc/lib/uidstore"
@@ -26,6 +27,8 @@ func init() {
 
 var errUnsupported = fmt.Errorf("unsupported command")
 
+const backgroundRefreshDelay = 1 * time.Minute
+
 type worker struct {
 	w                   *types.Worker
 	nmEvents            chan eventType
@@ -168,6 +171,12 @@ func (w *worker) handleConnect(msg *types.Connect) error {
 	}
 	w.done(msg)
 	w.emitLabelList()
+	go func() {
+		for {
+			w.nmEvents <- &updateDirCounts{}
+			time.Sleep(backgroundRefreshDelay)
+		}
+	}()
 	return nil
 }