Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Sending a notification from emacs
;; requires terminal-notifier
;; (☞ brew install terminal-notifiter)
(defvar terminal-notifier-command (executable-find "terminal-notifier") "The path to terminal-notifier.")
(defun terminal-notify (title message)
"Send an OS X notification.
Arguments are the notfication TITLE and MESSAGE.
From URL `'."
(start-process "terminal-notifier"
"-title" title
"-message" message
"-activate" "org.gnu.Emacs"))
(defun terminal-timed-notify (time msg)
"Send an OS X notification after given time.
When called interactively, prompts for MSG and TIME.
See `terminal-notify'."
(interactive "sNotification when (e.g: 2 minutes, 60 seconds, 3 days): \nsMessage: ")
(run-at-time time nil (lambda (msg) (terminal-notify "Emacs" msg)) msg))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.