Skip to content

firmart/notmuch-notify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

notmuch-notify

Notification for notmuch upon new email arrival.

screenshot.png

Features:

  • Notification and sound effect upon new email arrival.
  • Different alerts can be customized for different emails set.
  • Message on the the number of messages whenever notmuch-hello is refreshed.

Installation & Minimal Configuration

The following configuration relies on quelpa-use-package, but it is straightforward to clone this repo locally and use use-package instead. Moreover, this package uses alert as notification backend. See jwiegley/alert for options to fine-tune notifications (especially alert-default-style).

Below is a minimal configuration. Keep reading for more customizations.

(use-package notmuch-notify
  :ensure t
  :quelpa (notmuch-notify :fetcher github :repo "firmart/notmuch-notify")
  ;; (Recommended) activate stats message when refreshing `notmuch-hello' buffer
  :hook (notmuch-hello-refresh . notmuch-notify-hello-refresh-status-message)
  :config
  ;; (Recommended) activate system-wise notification timer
  (notmuch-notify-set-refresh-timer))

Define multiple alert profiles

An important feature of notmuch-notify is that it allows you to define severity, title, icon or audio per emails basis. This is done by configuring the variable notmuch-notify-alert-profiles which defines a list of alert profiles. An alert profile is a property list with the properties :name, :search-term, :severity, :title, :icon and :audio. The value of the last four, if missed, will fall back to their corresponding variable notmuch-notify-alert-default-*. Whereas the :name is merely for debugging purpose, the role of :search-term is central. It takes a notmuch search term to specify on which emails set the notification will be performed.

Example

Here is an example of further customization. It firstly excludes all emails having the notmuch tags Org-Mode and FromMe. It then reduces the email checking interval to 10 seconds. Finally, it sets two alert profiles:

  1. The inbox profile will match all emails tagged as inbox (but not those tagged as Org-Mode and FromMe), will change the title to Notmuch inbox: and change the icon and audio accordingly.
  2. The default profile will match any email which is not tagged as inbox, Org-Mode or FromMe. Its :severity, :title, :icon and :audio are the default ones (see below).
(setq notmuch-notify-excluded-tags '("Org-Mode" "FromMe"))
(setq notmuch-notify-refresh-interval 10)
(setq notmuch-notify-alert-profiles
 `((:name "inbox"
    :search-term "tag:inbox"
    :severity urgent
    :title "Notmuch inbox:"
    :icon ,(expand-file-name "img/inbox.jpg" user-emacs-directory)
    :audio ,(expand-file-name "audio/inbox.mp3" user-emacs-directory))
   (:name "default")))

Default configuration

This is a table of customizable variable, their default value and description.

VariableDefault valueNote
notmuch-notify-alert-profiles(see C-h v notmuch-notify-alert-profiles)Alert profiles. Customize different notifications for different emails.
notmuch-notify-alert-default-severitysymbol: normalAvailable symbols: trivial, low, normal, moderate, high, urgent. See jwiegley/alert.
notmuch-notify-alert-default-titlestring: Notmuch: new messageNotification title.
notmuch-notify-alert-default-iconstring: notmuch-logo.png (Notmuch official logo)Notification icon.
notmuch-notify-alert-default-audiostring: emailreceived.wav (Robot voice: “email received”)Notification audio.
notmuch-notify-alert-default-audio-programstring: mpvProgram to play notification audio.
notmuch-notify-excluded-tagsstring list: nilList of notmuch tags to exclude unconditionally from any notification.
notmuch-notify-refresh-intervalnumber: 60 (seconds)Interval between two check of unread messages.

Todo

  • Support actions for some profiles: e.g. repeat notification <x> times during <interval> until the email being read etc.
  • Make some data persistent in the disk to notify new emails during emacs down.

Contribution

Issues and PRs are welcomed.

Acknowledgement

About

Notmuch notification for new emails arrival.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published