unread_counter.lua

 1-- unread_counter.lua
 2-- Displays unread count in the inbox title bar.
 3
 4local matcha = require("matcha")
 5
 6local unread = 0
 7
 8matcha.on("email_received", function(email)
 9    if not email.is_read then
10        unread = unread + 1
11    end
12    matcha.set_status("inbox", unread .. " unread")
13end)
14
15matcha.on("folder_changed", function(folder)
16    unread = 0
17    matcha.set_status("inbox", "")
18end)