MC's Journal

OS X User Notifications from rcirc

Modern OS X has a nice way of alerting a user that something happened called User Notifications. They pop up in a corner of the screen and usually fade away after a while. Typically this is used for instant messages and mail notifications, et cetera.

I found that I would like to have User Notification when my nick was mentioned on an IRC channel or I was sent a private message. Here's how to do it.

First, grab terminal-notifier, a neat little program that generates User Notifications. Install it and test it out with, say:

/Applications/ -title Title -message Message

If that works, on to the next step. Now grab rcirc-notify.el. Patch it like so:

--- a/rcirc-notify.el
+++ b/rcirc-notify.el
@@ -34,9 +34,9 @@ same person.")
 (defun rcirc-send-notification (title message)
   (cond ((and (or (eq window-system 'mac)
                   (eq window-system 'ns))
-              (executable-find "growlnotify"))
-         (start-process "rcirc-notify" nil "growlnotify"
-                        "-t" title "-m" message "-a" "" (if rcirc-notify-sticky "-s" "")))
+              (executable-find "/Applications/"))
+         (start-process "rcirc-notify" nil "/Applications/"
+                        "-title" title "-message" message))
         ((and (eq window-system 'x)
               (executable-find "notify-send"))
          (start-process "rcirc-notify" nil

Eval the buffer and turn notify on with M-x turn-on-rcirc-notify RET.

Also add something like this to your .emacs.el:

(autoload 'rcirc-notify "rcirc-notify.el" "Notify me when something happens in IRC" t)

(eval-after-load 'rcirc
  '(require 'rcirc-notify))

Enjoy your User Notifications.