Check for new mail in a maildir folder

From awesome
Jump to: navigation, search

A simple widget for Awesome 3.x that checks for new mail in a maildir folder. Requires the Lua Filesystem Library and is currently designed to be used with Wicked.

Download: github.com/dmj

Usage[edit]

rc.lua:

require("mailcheck")
[...]
widgets.mail = widget({ type = "textbox", align = "right", name = "mail", width = 100 })
mailcheck.register( widgets.mail, settings.env.home .. "/Mail", "black", "darkgreen" )
wicked.register(widgets.mail, mailcheck.check, " mail: $1 ")
[...]

mailcheck.register takes two mandatory and two optional parameters:

  1. the textbox widget itself (mandatory)
  2. the maildir folder to check (mandatory)
  3. the widget's background color if mailbox is empty (optional, defaults to "black")
  4. the widget's background color if there are new messages (optional, defaults to "darkgreen")

mailcheck.check() returns the number of new messages and sets the widget's background accordingly