emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-mode and appointment notifications on Mac OS 10.8
@ 2013-02-13  7:16 Sarah Bagby
  2013-02-13 16:15 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Sarah Bagby @ 2013-02-13  7:16 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2613 bytes --]


I've been looking for a way to get org-mode to push appointment notifications from my org-agenda to the Notification Center on Mac OS 10.8 (Mountain Lion).  Thanks to Eloy Durán's terminal-notifier project (https://github.com/alloy/terminal-notifier), the code below seems to do the trick.  This is mostly hacked together from other people's approaches using different window functions:

http://emacs-fu.blogspot.com/2009/11/showing-pop-ups.html
http://article.gmane.org/gmane.emacs.orgmode/5271
http://article.gmane.org/gmane.emacs.orgmode/5806

I'm posting in the hopes that this will be useful to others, and would welcome any feedback.

Sarah Bagby

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(require 'appt)
(setq appt-time-msg-list nil)    ;; clear existing appt list
(setq appt-display-interval '10) ;; warn every 10 minutes from t - appt-message-warning-time
(setq
  appt-message-warning-time '10  ;; send first warning 10 minutes before appointment
  appt-display-mode-line nil     ;; don't show in the modeline
  appt-display-format 'window)   ;; pass warnings to the designated window function
(appt-activate 1)                ;; activate appointment notification
(display-time)                   ;; activate time display

(org-agenda-to-appt)             ;; generate the appt list from org agenda files on emacs launch
(run-at-time "24:01" 3600 'org-agenda-to-appt)           ;; update appt list hourly
(add-hook 'org-finalize-agenda-hook 'org-agenda-to-appt) ;; update appt list on agenda view

;; set up the call to terminal-notifier
(defvar my-notifier-path 
  "~/terminal-notifier_1.4.2/terminal-notifier.app/Contents/MacOS/terminal-notifier")  
(defun my-appt-send-notification (title msg)
  (shell-command (concat my-notifier-path " -message " msg " -title " title)))

;; designate the window function for my-appt-send-notification
(defun my-appt-display (min-to-app new-time msg)
  (my-appt-send-notification 
    (format "'Appointment in %s minutes'" min-to-app)    ;; passed to -title in terminal-notifier call
    (format "'%s'" msg)))                                ;; passed to -message in terminal-notifier call
(setq appt-disp-window-function (function my-appt-display))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


-----
Sarah Bagby
Postdoctoral scientist, Valentine lab
Department of Earth Science / Marine Science Institute
Webb Hall
UC Santa Barbara
Santa Barbara, CA 93106
bagby@geol.ucsb.edu
-----


[-- Attachment #2: Type: text/html, Size: 9654 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: org-mode and appointment notifications on Mac OS 10.8
  2013-02-13  7:16 org-mode and appointment notifications on Mac OS 10.8 Sarah Bagby
@ 2013-02-13 16:15 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2013-02-13 16:15 UTC (permalink / raw)
  To: Sarah Bagby; +Cc: emacs-orgmode

Hi Sarah,

Sarah Bagby <bagby@geol.ucsb.edu> writes:

> I'm posting in the hopes that this will be useful to others, and
> would welcome any feedback.

I'm not using Mac OS but I guess this will be useful, I just posted
a link to this email on http://orgmode.org/worg/org-hacks.html

Thanks!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-13 16:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-13  7:16 org-mode and appointment notifications on Mac OS 10.8 Sarah Bagby
2013-02-13 16:15 ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).