Browse Source

Use org-notify to show a notification and possibly play a sound.

Bastien Guerry 15 years ago
parent
commit
754694dd4b
3 changed files with 15 additions and 5 deletions
  1. 6 0
      lisp/ChangeLog
  2. 7 3
      lisp/org-clock.el
  3. 2 2
      lisp/org-timer.el

+ 6 - 0
lisp/ChangeLog

@@ -1,5 +1,11 @@
 2009-08-23  Bastien Guerry  <bzg@altern.org>
 
+	* org-timer.el (org-timer-set-timer): Use `org-notify' and play a
+	sound when showing the notification.
+
+	* org-clock.el (org-notify): New function.
+	(org-clock-notify-once-if-expired): Use `org-notify'.
+
 	* org-gnus.el (org-gnus-store-link): Handle `gnus-summary-mode'
 	and `gnus-article-mode' separately.
 	(gnus-summary-article-header): Fix the declare-function.

+ 7 - 3
lisp/org-clock.el

@@ -439,12 +439,16 @@ Notification is shown only once."
       (if (>= clocked-time effort-in-minutes)
 	  (unless org-clock-notification-was-shown
 	    (setq org-clock-notification-was-shown t)
-	    (org-clock-play-sound)
-	    (org-show-notification
+	    (org-notify
 	     (format "Task '%s' should be finished by now. (%s)"
-		     org-clock-heading org-clock-effort)))
+		     org-clock-heading org-clock-effort) t))
 	(setq org-clock-notification-was-shown nil)))))
 
+(defun org-notify (notification &optional play-sound)
+  "Send a NOTIFICATION and maybe PLAY-SOUND."
+  (org-show-notification (notification))
+  (if play-sound (org-clock-play-sound)))
+
 (defun org-show-notification (notification)
   "Show notification.
 Use `org-show-notification-handler' if defined,

+ 2 - 2
lisp/org-timer.el

@@ -317,8 +317,8 @@ VALUE can be `on', `off', or `pause'."
 		(if (not (or (eval timer) timer-set))
 		    (setq timer-set t
 			  timer
-			  (run-with-timer secs nil 'org-show-notification
-					  (format "%s: time out" hl))
+			  (run-with-timer
+			   secs nil 'org-notify (format "%s: time out" hl) t)
 			  org-timer-last-timer timer)))
 	      '(org-timer-timer1
 		org-timer-timer2