recipient_counter.lua

 1-- recipient_counter.lua
 2-- Shows the number of recipients in the composer status bar.
 3
 4local matcha = require("matcha")
 5
 6matcha.on("composer_updated", function(state)
 7    if state.to == "" then
 8        return
 9    end
10    local count = 0
11    for _ in state.to:gmatch("[^,]+") do
12        count = count + 1
13    end
14    if count > 1 then
15        matcha.set_status("composer", count .. " recipients")
16    end
17end)