Friday, January 1, 2021

Enable ERC notifications on macOS

1 Enable ERC notifications on macOS

A quick post on how to enable ERC notification on macOS via Notification Center using AppleScript:

;; Send notification using Apple Script on macOS
(defun galactic-emacs-erc-ns-notify (nick msg &optional PRIVP)
  "Notify that NICK send a MSG using Apple Notification Center"
  (ns-do-applescript (concat "display notification \"" nick
                             " wrote: " msg "\"" "with title"
                             "\"ERC Notification\"")))
;; Desktop notifications
(require 'erc-desktop-notifications)
(erc-notifications-enable)
;; Use Notification Center on macOS
(when (string= system-type "darwin")
  (advice-add 'erc-notifications-notify :after #'galactic-emacs-erc-ns-notify))

No comments:

Post a Comment