emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* pop-up flashing box using org-timer?
@ 2015-12-09 13:32 Sharon Kimble
  2015-12-09 16:20 ` Nick Dokos
  0 siblings, 1 reply; 2+ messages in thread
From: Sharon Kimble @ 2015-12-09 13:32 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 3203 bytes --]

I'm using org-timer via "C-c C-x ;" and setting it for 30 minutes for a
repetitive job that I'm doing. When it ends it has a small popup which
shows its ended but that soon disappears. Is it possible for it to show
a flashing popup that will show even if I'm not an org-mode buffer? Like
in the code block showing at the end?

I am using the following code for showing appointments that are, and
have just, occurred. Is it possible for this code be adapted to show a
similar popup that flashes like this does please?

Thanks
Sharon.

--8<---------------cut here---------------start------------->8---
#+BEGIN_SRC emacs-lisp
(appt-activate t)
;; 5 minute warning
(setq appt-message-warning-time '15)
(setq appt-display-interval '5)
#+END_SRC
[2014-11-14 Fri 11:43]

#+BEGIN_SRC emacs-lisp
(defun djcb-popup (title msg &optional icon sound)
  ;; http://emacs-fu.blogspot.co.uk/2009/11/showing-pop-ups.html
  "Show a popup if we're on X, or echo it otherwise; TITLE is the title
of the message, MSG is the context. Optionally, you can provide an ICON and
a sound to be played"

  (interactive)
  (when sound (shell-command
                (concat "mplayer -really-quiet " sound " 2> /dev/null")))
  (if (eq window-system 'x)
    (shell-command (concat "notify-send "

                     (if icon (concat "-i " icon) "")
                     " '" title "' '" msg "'"))
    ;; text only version

    (message (concat title ": " msg))))

(djcb-popup "Warning" "The end is near"
         "/usr/share/icons/test.png" "/usr/share/sounds/beep.ogg")

;; the appointment notification facility
(setq
  appt-message-warning-time 15 ;; warn 15 min in advance

  appt-display-mode-line t     ;; show in the modeline
  appt-display-format 'window) ;; use our func
(appt-activate 1)              ;; active appt (appointment notification)
(display-time)                 ;; time display is required for this...

 ;; update appt each time agenda opened

(add-hook 'org-finalize-agenda-hook 'org-agenda-to-appt)

;; our little façade-function for djcb-popup
 (defun djcb-appt-display (min-to-app new-time msg)
    (djcb-popup (format "Appointment in %s minute(s)" min-to-app) msg
      "/usr/share/icons/gnome/32x32/status/appointment-soon.png" ))

      ;; "/usr/share/sounds/ubuntu/stereo/phone-incoming-call.ogg"

  (setq appt-disp-window-function (function djcb-appt-display))

;; you might also want to set:
   (setq org-agenda-skip-unavailable-files t)
;; so these warnings won't annoy the little remember-frame
;; also: I have noted infrequent problems when using ElScreen
;;  (the wrong frame might be chosen for Remember in about 10% of the cases)
#+END_SRC
[2014-11-14 Fri 12:07]

#+BEGIN_SRC emacs-lisp
(defun my-appt-disp-window (min-to-app new-time msg)
       (save-window-excursion (async-shell-command
       (concat "/usr/bin/zenity --info --title='Appointment' --text='" msg "'")   nil nil)))
 #+END_SRC
[2014-11-14 Fri 11:44]
--8<---------------cut here---------------end--------------->8---


-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
Debian 8.0, fluxbox 1.3.7, emacs 24.5.1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: pop-up flashing box using org-timer?
  2015-12-09 13:32 pop-up flashing box using org-timer? Sharon Kimble
@ 2015-12-09 16:20 ` Nick Dokos
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Dokos @ 2015-12-09 16:20 UTC (permalink / raw)
  To: emacs-orgmode

Sharon Kimble <boudiccas@skimble.plus.com> writes:

> I'm using org-timer via "C-c C-x ;" and setting it for 30 minutes for a
> repetitive job that I'm doing. When it ends it has a small popup which
> shows its ended but that soon disappears. Is it possible for it to show
> a flashing popup that will show even if I'm not an org-mode buffer? Like
> in the code block showing at the end?
>

The timer code uses org-notify which in turn uses org-show-notification.

The latter goes through a sequence of steps, until one succeeds:

It first checks whether org-show-notification-handler is defined and
either calls it (if a function) or executes it (if a string); so you
can define it to be something that does what you want.

If that is not defined, it checks whether notifications-notify is bound
and is a function, and calls it if so (in my case at least, it's not
defined).

It then checks whether there is an executable called notify-send on the
system and if so, it executes it (that's what happens in my case with
Fedora 22 Linux). The appt popup code you quote also uses notify-send
(assuming that X is running). BTW, I'm not sure what happens if you execute
notify-send on the console.

Finally, as a last resort and if everything else has failed, it calls
message to put the notification in the echo area.

HTH.
--
Nick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-09 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-09 13:32 pop-up flashing box using org-timer? Sharon Kimble
2015-12-09 16:20 ` Nick Dokos

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).