Is there an easy way of having tea-time display messages via gnome's native notification system?

The current "notification function" in tea-time.el is:

(defun show-notification (notification)
  "Show notification. Use mumbles."
 (if (program-exists "mumbles-send")
    (start-process "tea-time-mumble-notification" nil "mumbles-send" notification)
  (message notification)

I tried editing this to use notify-send instead, without any success: specifically using something like (shell-command (concat "notify-send " notification)) in place of (start-process "tea-time-mumble-notification" nil "mumbles-send" notification) doesn't seem to work (I got rid of the if-statement as well, of course).


4 Answers 4


Yes, just call notify-send command from the alert hook (if there is one, otherwise you might need to patch tea-time to have that.)

  • 1
    Thanks. I added more info in my original question: suggestions on how to call notify-send? Jun 6, 2011 at 16:26
  • No idea. Care to ask/search on some Emacs forum or search through emacswiki.org?
    – alex
    Jun 6, 2011 at 16:37
  • @BeSlayed :perhaps, redefine the cited function to use the suggested notify-send (instead of that mumbles-send)? Jun 6, 2011 at 17:46
  • @imz: yes, I have tried (defun show-notification (notification) (shell-command (concat "notify-send " notification) )) (which seems like what you're suggesting), but I get a "Invalid number of options" error. Jun 7, 2011 at 2:01

In Emacs 24, you can use notifications.el to send D-Bus notifications directly from elisp code. Rewriting @yhager's hook, above:

(add-hook 'tea-time-notification-hook
  (lambda ()
    (notifications-notify :title "Time is up!"
                          :body "I know you're busy, but it's TEA TIME!!"
                          :app-name "Tea Time"
                          :sound-name "alarm-clock-elapsed)))

There are more useful args described on the Notifications page of the Emacs Lisp Reference Manual (including the :sound-file option, instead of :sound-name, which requires an XDG sound theme implementation).


By trial and error I figured out that the following redefinition works:

(defun show-notification (notification)
"Show notification. Use notify-send."
(start-process "tea-time-notify-notification" nil "notify-send" notification)

Fancier stuff can be done as well: using

(start-process "tea-time-notify-notification" nil "notify-send" "-i" (expand-file-name "~/path/to/your/icon/YourIconName.png") "Emacs Tea Timer" notification)

tells the notification daemon to use an icon (this one is suitable) in the notification pop-up and uses a emboldened 'summary' text ("Emacs Tea Timer").


With the latest tea-time.el, you have a hook you can use for that.
Add to your Emacs initialization:

(add-hook 'tea-time-notification-hook 
  (function (lambda() 
    (start-process "tea-timer-notification" nil "notify-send" "Time is up!"))))

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .