Skip to content

mail ​

Unread mail count, backed by a notmuch query.

Runs notmuch count <query> and re-queries whenever the maildir changes (event-driven via an inotify watch on the notmuch database path). Hidden while the count is zero when hide-when-zero is set.

Add it to your layout with mail:

yaml
bar:
  layout:
    - monitor: "*"
      right: [mail]

General ​

FieldTypeDefaultDescription
formatstring"{{ count }}"Format string for the label.
querystring"tag:unread"notmuch search query whose match count is shown.
accountsarray of MailAccount[]Per-account unread breakdown shown in the mail dropdown. Each account has its own notmuch query and a provider (for its icon). When set, the bar count/label is the sum across accounts and query is ignored.
hide-when-zerobooltrueHide the module entirely while the count is zero.
notifyboolfalseFire a desktop notification when the unread count rises — i.e. new mail arrives. One notification per newly-arrived message (capped per burst), showing its sender and subject. With accounts configured, each notification uses that account's provider icon; otherwise the module icon is used.
notify-summarystring"{{ sender }}"Notification summary when new mail arrives.
notify-bodystring"{{ subject }}"Notification body when new mail arrives. Same placeholders as notify-summary.
icon-namestring"ld-mail-symbolic"Module icon.
border-showboolfalseDisplay border around button.
icon-showbooltrueDisplay module icon.
label-showbooltrueDisplay label.
label-max-lengthu320Max label characters before truncation with ellipsis. Set to 0 to disable.
More about format

Placeholders ​

  • {{ count }} - Number of messages matching the query

Examples ​

  • "{{ count }}" - "3"
More about query

Any query notmuch count accepts, e.g. tag:unread, tag:unread and tag:inbox, folder:work and tag:unread.

Ignored when accounts is non-empty — the bar count is then the sum of the per-account queries.

More about notify-summary

Placeholders ​

  • {{ sender }} - Message sender (name or address)
  • {{ subject }} - Message subject
  • {{ count }} - Total messages matching the query
  • {{ new }} - How many arrived since the last count

Colors ​

FieldTypeDefaultDescription
border-colorColorValue"blue"Border color token.
icon-colorColorValue"auto"Icon foreground color. Auto selects based on variant for contrast.
icon-bg-colorColorValue"bg-surface-elevated"Icon container background color token.
label-colorColorValue"auto"Label text color token.
button-bg-colorColorValue"bg-surface-elevated"Button background color token.

Click actions ​

FieldTypeDefaultDescription
left-clickClickAction"dropdown:mail"Action on left click. Defaults to opening the per-account dropdown; set to empty for no action, or a shell command (e.g. your mail client).
right-clickClickAction""Action on right click.
middle-clickClickAction""Action on middle click.
scroll-upClickAction""Action on scroll up.
scroll-downClickAction""Action on scroll down.

Default configuration ​

yaml
modules:
  mail:
    format: '{{ count }}'
    query: tag:unread
    accounts: []
    hide-when-zero: true
    notify: false
    notify-summary: '{{ sender }}'
    notify-body: '{{ subject }}'
    icon-name: ld-mail-symbolic
    border-show: false
    border-color: blue
    icon-show: true
    icon-color: auto
    icon-bg-color: bg-surface-elevated
    label-show: true
    label-color: auto
    label-max-length: 0
    button-bg-color: bg-surface-elevated
    left-click: dropdown:mail
    right-click: ""
    middle-click: ""
    scroll-up: ""
    scroll-down: ""

Released under the MIT License.