MC's journal

Boomtime, the 52 day of Chaos in the YOLD 3180

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/terminal-notifier.app/Contents/MacOS/terminal-notifier -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" "Emacs.app" (if rcirc-notify-sticky "-s" "")))
+              (executable-find "/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier"))
+         (start-process "rcirc-notify" nil "/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier"
+                        "-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.


Written by MC using Emacs and friends.