Skip to content

Conversation

@Stebalien
Copy link
Contributor

This PR brings two (breaking) improvements to the notmuch block:

  1. The first change watches the database lock instead of relying on an update interval. From my testing, this only triggers when the database was opened for writing. NOTE: I'm not doing this to get email notifications faster, I just don't want to query the notmuch database every 10s.
  2. The second change improves the notmuch block's configuration. Specifically, it renames maildir to database and makes the field optional, while also adding a new optional profile option. This should bring the block in-line with the notmuch CLI tool (the same defaults and environment variables will be used). In most cases, this means the user can simply omit any database configuration.

Both of these changes are breaking as they change the config. I'm happy to split them into multiple PRs and/or add a better migration path if desired.

@Stebalien Stebalien force-pushed the steb/notmuch-file-watch branch from dad5a9e to 9a76b04 Compare October 4, 2025 22:47
Specifically, this re-runs the count command whenever the databased lock
is released. This event is triggered whenever the database is closed
after it was opened for writing, but NOT when it was opened for reading.
1. The notmuch database may not be the same as the maildir.
2. Notmuch has some pretty thorough logic for automatically locating the
database (documented in notmuch(3)).

This change:

1. Renames the `maildir` option to `database` to accurately reflect its
purpose.
2. Makes the `database` option optional.
3. Adds a `profile` option so the user can specify the notmuch profile
they want to use without hard-coding the path to the database.
@Stebalien Stebalien force-pushed the steb/notmuch-file-watch branch from 9a76b04 to 3707630 Compare October 5, 2025 00:22
@Stebalien
Copy link
Contributor Author

TBH, I'd also be in favor of removing this block given that:

  1. It requires the notmuch library (and will therefore almost certainly require that the user compile from source).

  2. It can easily be implemented with a custom block:

    [[block]]
      block = "custom"
      watch_files = ["~/.local/share/notmuch/default/xapian/flintlock"]
      interval = "once"
      format = "$icon $text "
      command = "notmuch count --output=threads tag:inbox and tag:unread"

(I just figured I'd improve it as long as it exists)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant