emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ivan Vilata i Balaguer <ivan@elvil.net>
To: emacs-orgmode@gnu.org
Subject: Re: Reminders with alarms
Date: Mon, 03 Oct 2011 13:45:49 +0200	[thread overview]
Message-ID: <87zkhq860y.fsf@rampella.terramar.selidor.net> (raw)
In-Reply-To: CAFm0skF3Pwo8z7pL_iBpp4PqBUORu5j-KiE6bKHxAzJNVEojXQ@mail.gmail.com

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 <neilm@juliet.ll.mit.edu>
> ...
> (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	other threads:[~2011-10-03 16:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-07  5:39 Reminders with alarms Stephen Nelson-Smith
2011-09-07  7:40 ` Eric S Fraga
2011-09-07  8:42 ` Eric Abrahamsen
2011-09-07 16:25 ` Bernt Hansen
2011-09-07 19:05 ` Martyn Jago
2011-09-08  3:10   ` Jude DaShiell
2011-09-08 15:42     ` brian powell
2011-10-03 11:45       ` Ivan Vilata i Balaguer [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=87zkhq860y.fsf@rampella.terramar.selidor.net \
    --to=ivan@elvil.net \
    --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).