emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Reminders with alarms


From: Ivan Vilata i Balaguer
Subject: Re: [O] Reminders with alarms
Date: Mon, 03 Oct 2011 13:45:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

brian powell (2011-09-08 17:42:02 +0200) wrote:

> P.S. I've used calendar/*Fancy Diary Entries* and appt.el for many
> years--works great--I just have it pop up a big blank emacs screen
> with the alarm reminder--I usually set it for 15 minutes ahead of the
> important reminder:
> ;;; appt.el --- appointment notification functions.
> ;; Copyright (C) 1989, 1990, 1994 Free Software Foundation, Inc.
> ;; Author: Neil Mager <address@hidden>
> ...
> (setq appt-message-warning-time 15)
> (setq appt-display-interval 5)

I also use appt.el, but I've written a notification function that calls
a little script to use FreeDesktop.org's notifications and send a
message to Screen sessions.  The script is only called from the Emacs
server process to avoid repeated messages, since I may have other Emacs
processes running.

The function is (customize appt-disp-window-function to use this):

----8<----
(defun ivb/appt-disp-window (min-to-app new-time appt-msg)
  (if (condition-case nil
          (server-running-p)
        (void-function nil))
      (call-process "notify" nil 0 nil "Reminder" appt-msg))
  (appt-disp-window min-to-app new-time appt-msg))
----8<----

The "notify" script contains:

----8<----
#!/bin/sh

case $# in
1)   title="Notification" message="$1" ;;
2)   title="$1" message="$2" ;;
*)   echo "Usage: $(basename $0) [TITLE] MESSAGE" > /dev/stderr
     exit 1
esac

# Show X notification on current display.
test "$DISPLAY" && notify-send -t 0 "$title" "$message"

# Notify screen sessions.
for scrname in $(screen -ls | sed -ne 's/^\t\([^\t]*\)\t.*/\1/p')
do
        screen -S $scrname -X wall "$title: $message"
done
----8<----

It should be executable and placed in your $PATH.  On Debian/Ubuntu
you'll need the libnotify-bin and screen packages.

Customize appt-display-duration, appt-display-interval and
appt-message-warning-time to your liking, then run:

----8<----
(appt-activate +1)
(bh/org-agenda-to-appt)
----8<----

HTH,
-- 
Ivan Vilata i Balaguer -- http://elvil.net/




reply via email to

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