1

I'm looking for a way to have emacs send me desktop notifications (on Windows 10) for appointments in my org file. I did find a way to be notified within emacs (https://sachachua.com/blog/2007/11/setting-up-appointment-reminders-in-org/) and also how to have a desktop notification on Mac (https://lists.gnu.org/archive/html/emacs-orgmode/2013-02/msg00644.html ) and also on Linux (Good methods for setting up alarms (audio + visual) triggered by org-mode events? ) but not on Windows. Can anyone help me with that maybe through Windows native message boxes or Autohotkeys? Thanks!

2 Answers 2

1

Found a solution buried in this video: https://vimeo.com/16533939 It uses a visual basic code that popups up a message showing the title of your event. Here's the VB code (I put it in a file named PopUp.vbs):

On Error Resume Next
Msgbox wscript.Arguments(0),0,"Agenda Reminder"

and here's the configuration needed in your .emacs or .spacemacs file (you need to modify the path to the VB file accordingly):

;; Enabling the "appt" Windows notifier
  ;; https://vimeo.com/16533939
  ;; Get appointments for today
  (defun my-org-agenda-to-appt ()
    "Rebuild all appt reminders"
    (interactive)
    (setq appt-time-msg-list nil)
    (run-at-time "24:01" nil 'my-org-agenda-to-appt)
    (let ((org-deadline-warning-days 0))
      (org-agenda-to-appt)))

  ;;; Disabled so that I can open multiple emacs without org loading agenda files
  (appt-activate t)

  ;; 5 minutes warning
  (setq appt-message-warning-time '60)
  (setq appt-display-interval '15)

  ;; Update appt each time agenda is opened
  (add-hook 'org-finalize-agenda-hook 'my-org-agenda-to-appt)

  ;; Setup agenda popup, we tell appt to use window, and replace default function
(setq appt-display-format 'window)
(setq appt-disp-window-function (function my-appt-disp-window))

(defun my-appt-disp-window (min-to-app new-time msg)
  (save-window-excursion
    (shell-command
     (concat
      "c:/Windows/System32/cscript.exe //nologo c:/Dropbox/ToDo/PopUp.vbs \"" msg "\"")nil nil)))
0

A bit late to the party but here is what I use. For alerts, I use the alert package, for which you can define custom notification styles. On the below snippet, I defined one to use the built-in w32-notification-notify

(use-package alert
  :config
  ;; Add the windows desktop notifications if on windows
  (when (eq system-type 'windows-nt)
    (alert-define-style
     'windows-desktop-notification-style
     :title "Windows Desktop Notification style"
     :notifier
     (lambda (info)
       (let ((notif-id (w32-notification-notify :title (plist-get info :title) :body (plist-get info :message))))
         ;; Close it after 3 seconds (no new notification can be sent if left unclosed)
         (run-with-timer 3 nil `(lambda() (w32-notification-close ,notif-id))))))
    (setq alert-default-style 'windows-desktop-notification-style)))

To be reminded of everything in my org agenda, I use the org-alert package (which conveniently uses alert under the hood)

(use-package org-alert
  :demand  ; Load it on startup, not lazily
  :config
  (org-alert-enable))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.