emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: Idea for agenda notifications


From: Eric S Fraga
Subject: [Orgmode] Re: Idea for agenda notifications
Date: Mon, 27 Apr 2009 18:27:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

Marcelo de Moraes Serpa <address@hidden> writes:

> Awesome! This idea could be extended to add other kind of events, like
> send emails, SMS, play some audio file, whatever (turn org-mode in a
> kind of PIM server too.. hmm, lots of cool ideas come to my mind). I
> still prefer using the gnome-notifier but it shouldn't be hard to
> adapt it for that.
>
> Well -- the first thing I need to do though is to master elisp :)

I use a similar mechanism based on osd (on screen display) which doesn't
pop up windows but simply writes text directly onto the display (over
top of anything and everything).  Much less intrusive than a pop-up
window (IMO... YMMV) and is completely window manager agnostic (perfect
for my Asus running X with ratpoison, for instance).

The original code comes from Richard Riley and I believe the code I have
was modified by Nick Dokos?  In any case, the code is below.  My elisp
is not good enough to determine which bits are absolutely necessary,
mind you...  On Debian systems, you would need to install the gnome-osd
package.

Hope this helps!

----------------------------------------------- cut here --------------

(require 'appt)
(defun rgr/xml-escape (s)
  (setq s (replace-regexp-in-string "'" "&apos;" 
  (replace-regexp-in-string "\"" "&quot;"
  (replace-regexp-in-string "&" "&amp;" 
  (replace-regexp-in-string "<" "&lt;"
  (replace-regexp-in-string ">" "&gt;" s)))))))

(when window-system
  (defun rgr/osd-display (id msg &optional delay vattrib hattrib font) 
    "Display a message msg using OSD. Currently requires gnome-osd-client"
    (unless vattrib (setq vattrib "top"))
    (unless hattrib (setq hattrib "right"))
    (unless delay (setq delay 5000))
    (unless font (setq font "Arial 12"))
    (save-window-excursion
      (shell-command
       (format
        "gnome-osd-client -f \"<message id='%s' osd_fake_translucent_bg='off' 
osd_font='%s' animations='on' hide_timeout='%d' osd_vposition='%s' 
osd_halignment='%s'>%s</message>\""    
        id
        font
        delay
        vattrib
        hattrib
        (rgr/xml-escape msg)
        )))))
(when window-system

  (setq appt-display-format 'window)
  
  (defun org-osd-display (min-to-app new-time msg)
    (rgr/osd-display msg msg -1 "center" "left" "Verdana 20"))
  
  (setq appt-disp-window-function (function org-osd-display))
  
  ;; Run once, activate and schedule refresh
  (run-at-time nil 3600 'org-agenda-to-appt)
  (appt-activate t))

(setq appt-time-msg-list nil)
(org-agenda-to-appt)

(defadvice  org-agenda-redo (after org-agenda-redo-add-appts)
  "Pressing `r' on the agenda will also add appointments."
  (progn 
    (setq appt-time-msg-list nil)
    (org-agenda-to-appt)))

(ad-activate 'org-agenda-redo)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]