< Olaf Dietsche
> -- OlafDietsche
This code shows how to implement an onscreen display of Org-Mode appointments at the configured warning time. It requires gnome-osd package but it would be fairly trivial to use other desktop environment equivalents I think.
Another option is to use ToDoChiKu, which should work cross-platform.
The first code is the interface to the OSD layer:
(defun rgr/xml-escape (s) (setq s (replace-regexp-in-string "'" "'" (replace-regexp-in-string "\"" """ (replace-regexp-in-string "&" "&" (replace-regexp-in-string "<" "<" (replace-regexp-in-string ">" ">" 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) )))))
In debian, for example, you would install the gnome-osd package like this:
sudo apt-get install gnome-osd
Then we need to set up org-mode to use a new display function for informing the user about upcoming appointments:
(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" "center" "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))
I did try the window manager neutral OSD equivalent but it simply did not work well enough but if anyone does get it to work then please update here accordingly.
With osd_cat (package xosd-bin from debian) the function is similar:
(defun org-osd-display (min time msg) (let ((vpos "middle") (hpos "center") (font "-adobe-courier-*-r-*-*-34-*") (delay 5)) (save-window-excursion (shell-command (format "echo '%s' | osd_cat --pos=%s --align=%s --font=%s --delay=%d" msg vpos hpos font delay)))))