prevent_auto_read.lua

 1-- prevent_auto_read.lua
 2-- Prevents emails from being automatically marked as read when opened.
 3-- When enabled, emails stay unread until explicitly marked (e.g. via toggle_read).
 4
 5local matcha = require("matcha")
 6
 7local cfg = matcha.settings({
 8    enabled = {
 9        type        = "boolean",
10        default     = true,
11        label       = "Prevent auto-read",
12        description = "When on, opening an email does not mark it as read.",
13    },
14})
15
16matcha.on("email_viewed", function(email)
17    if cfg.enabled then
18        matcha.suppress_auto_read()
19    end
20end)