emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric S Fraga <e.fraga@ucl.ac.uk>
To: emacs-orgmode@gnu.org
Subject: Re: Idea for agenda notifications
Date: Mon, 27 Apr 2009 18:27:53 +0100	[thread overview]
Message-ID: <878wlmgg6e.fsf@eeepc.chemeng.ucl.ac.uk> (raw)
In-Reply-To: 1e5bcefd0904241637o37471c44n2bf1e4f769fe600d@mail.gmail.com

Marcelo de Moraes Serpa <celoserpa@gmail.com> 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	other threads:[~2009-04-27 18:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-24 17:02 Idea for agenda notifications Marcelo de Moraes Serpa
2009-04-24 17:14 ` Friedrich Delgado Friedrichs
2009-04-24 17:17 ` Bernt Hansen
2009-04-24 17:28   ` Marcelo de Moraes Serpa
2009-04-24 17:35     ` Marcelo de Moraes Serpa
2009-04-24 17:55       ` Bernt Hansen
2009-04-24 19:54         ` Russell Adams
2009-04-24 23:37           ` Marcelo de Moraes Serpa
2009-04-27 17:27             ` Eric S Fraga [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878wlmgg6e.fsf@eeepc.chemeng.ucl.ac.uk \
    --to=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).