aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/aerc-notmuch.5.scd6
-rw-r--r--worker/notmuch/eventhandlers.go4
-rw-r--r--worker/notmuch/worker.go8
3 files changed, 16 insertions, 2 deletions
diff --git a/doc/aerc-notmuch.5.scd b/doc/aerc-notmuch.5.scd
index 0ba57d1e..20f906d9 100644
--- a/doc/aerc-notmuch.5.scd
+++ b/doc/aerc-notmuch.5.scd
@@ -66,6 +66,12 @@ options are available:
This is optional. If specified, it will be used by aerc to list
available folders and enable commands such as *:delete* and *:archive*.
+*maildir-account-path* = _<path>_
+ Path to the maildir account relative to the *maildir-store*.
+
+ This could be used to achieve traditional maildir one tab per account
+ behavior.
+
# USAGE
Notmuch shows slightly different behavior than for example imap. Some commands
diff --git a/worker/notmuch/eventhandlers.go b/worker/notmuch/eventhandlers.go
index ca92d7eb..a6ab7668 100644
--- a/worker/notmuch/eventhandlers.go
+++ b/worker/notmuch/eventhandlers.go
@@ -5,6 +5,7 @@ package notmuch
import (
"fmt"
+ "path/filepath"
"strconv"
"git.sr.ht/~rjarry/aerc/worker/types"
@@ -27,7 +28,8 @@ func (w *worker) handleUpdateDirCounts() error {
return err
}
for name := range folders {
- query := fmt.Sprintf("folder:%s", strconv.Quote(name))
+ folder := filepath.Join(w.maildirAccountPath, name)
+ query := fmt.Sprintf("folder:%s", strconv.Quote(folder))
w.w.PostMessage(&types.DirectoryInfo{
Info: w.getDirectoryInfo(name, query),
}, nil)
diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go
index cf58d987..85f813da 100644
--- a/worker/notmuch/worker.go
+++ b/worker/notmuch/worker.go
@@ -43,6 +43,7 @@ type worker struct {
queryMapOrder []string
nameQueryMap map[string]string
store *lib.MaildirStore
+ maildirAccountPath string
db *notmuch.DB
setupErr error
currentSortCriteria []*types.SortCriterion
@@ -225,6 +226,10 @@ func (w *worker) handleConfigure(msg *types.Configure) error {
if err != nil {
return err
}
+
+ w.maildirAccountPath = msg.Config.Params["maildir-account-path"]
+
+ path = filepath.Join(path, w.maildirAccountPath)
store, err := lib.NewMaildirStore(path, false)
if err != nil {
return fmt.Errorf("Cannot initialize maildir store: %w", err)
@@ -319,7 +324,8 @@ func (w *worker) handleOpenDirectory(msg *types.OpenDirectory) error {
folders, _ := w.store.FolderMap()
dir, ok := folders[msg.Directory]
if ok {
- q = fmt.Sprintf("folder:%s", strconv.Quote(msg.Directory))
+ folder := filepath.Join(w.maildirAccountPath, msg.Directory)
+ q = fmt.Sprintf("folder:%s", strconv.Quote(folder))
if err := w.processNewMaildirFiles(string(dir)); err != nil {
return err
}