/mu4e-alert

Desktop notifications and modeline display for mu4e

Primary LanguageEmacs Lisp

mu4e alert

http://melpa.org/packages/mu4e-alert-badge.svg http://stable.melpa.org/packages/mu4e-alert-badge.svg

images/mu4e-alert-in-action.png?raw=true

What is this?

mu4e-alert is an Emacs extension providing desktop notifications for mu4e, additionally it can display the number of unread emails in the mode-line.

Requirements

This package requires Emacs v24.1 or above. It assumes that you have a working mu/mu4e setup.

Installation

ELPA

mu4e-alert is available on MELPA and MELPA Stable. Please follow the instructions on MELPA website to enable it, if you haven’t already.

You can then install mu4e-alert from the package menu. Alternatively install it by doing the following

Refresh the package index

M-x package-refresh-contents RET

And then install it by doing

M-x package-install RET mu4e-alert

El-get

mu4e-alert can also be installed using el-get. Assuming you have latest version of el-get installing it by doing something similar to

M-x el-get-install RET mu4e-alert

Usage

To enable desktop notifications manually, use the command mu4e-alert-enable-notifications. To enable notification automatically on Emacs startup add something like the following to you init file

;; Choose the style you prefer for desktop notifications
(mu4e-alert-set-default-style 'libnotify)
(add-hook 'after-init-hook #'mu4e-alert-enable-notifications)

mu4e-alert uses the value of alert-default-style as the default notification style, which defaults to message, if you want to use different style please add a rule for category “mu4e-alert” using alert’s API or use the function mu4e-alert-set-default-style to customize the value of mu4e-alert-style.

You can disable notifications using the command mu4e-alert-disable-notifications

You can additionally enable display of the unread email count in the mode-line using the command mu4e-alert-enable-mode-line-display or adding something like the following to your init file

(add-hook 'after-init-hook #'mu4e-alert-enable-mode-line-display)

After enabling mode-line display the unread emails can be viewed by clicking the mode-line indicator.

Use the command mu4e-alert-disable-mode-line-display to disable mode-line indication of unread emails

Customizations

mu4e-alert should work with default options, nevertheless it offers the following customizations. Please see the mu4e-alert.el file or do M-x customize-group RET mu4e-alert RET to for documentation of customizable options.

General options

The query used to find unread (read ‘interesting’) emails can be customized using the variable mu4e-alert-interesting-mail-query

Customizing the desktop notifications

mu4e-alert allows you to customize the desktop notifications by setting the following values

VariableAspect customizedDefault
mu4e-alert-titleTitle used for notificationsmu4e
mu4e-alert-notification-formatterFormatting the message body of the notificationmu4e-alert-default-notification-formatter
mu4e-alert-set-default-styleStyle used for the desktop notificationsmessage

Customizing the mode-line display

The mode-line indicator for unread emails can be customized by setting the value of the variable mu4e-alert-modeline-formatter

Advanced customizations

mu4e-alert uses the excellent alert library for desktop notifications, more fine-grained customizations to the notifications can be done by using the alert’s API.

As an example the following customization will color the fringe (along with the usual desktop notification) if there are unread messages and the user is visiting one of mu4e-main-view, mu4e-headers-view or viewing an email in mu4e.

(mu4e-alert-set-default-style 'libnotify)
(alert-add-rule :category "mu4e-alert" :style 'fringe :predicate (lambda (_) (string-match-p "^mu4e-" (symbol-name major-mode))) :continue t)
(mu4e-alert-enable-notifications)