Skip to content

Commit

Permalink
Add org-notify option to org-layer
Browse files Browse the repository at this point in the history
  • Loading branch information
dalanicolai committed Feb 20, 2021
1 parent e4452f9 commit abd2f60
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.develop
Original file line number Diff line number Diff line change
Expand Up @@ -2800,6 +2800,7 @@ files (thanks to Daniel Nicolai)
- Added package =org-rich-yank= (thanks to Keith Pinson)
- Added package =org-roam= (thanks to Mariusz Klochowicz)
- Added package =org-contacts= (thanks to Daniel Nicolai)
- Added package =org=notify= (thanks to Daniel Nicolai)
- Key bindings:
- ~SPC m T i~ to toggle inline images
- Move clock related key bindings to ~SPC a o C~
Expand Down
32 changes: 32 additions & 0 deletions layers/+emacs/org/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- [[#important-note][Important Note]]
- [[#install][Install]]
- [[#layer][Layer]]
- [[#agenda-notifications][Agenda notifications]]
- [[#github-support][GitHub support]]
- [[#twitter-bootstrap-support][Twitter Bootstrap support]]
- [[#gnuplot-support][Gnuplot support]]
Expand Down Expand Up @@ -112,6 +113,37 @@ To use this configuration layer: in the main Spacemacs configuration
file (=~/.spacemacs=), to the existing =dotspacemacs-configuration-layers= list
add the =org= entry.

** Agenda notifications
To enable notifications for agenda events, set the variable
=org-enable-notifications= to =t=.

#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers '(
(org :variables
org-enable-notifications t
org-start-notification-daemon-on-startup t)))
#+END_SRC

This will install and configure the [[https://github.com/tkf/org-mode/blob/master/contrib/lisp/org-notify.el][org-notify]] package. Run the
=org-notify-start= command to start the =org-notify= notification daemon. To
start the notification daemon automatically on Spacemacs startup, set the
variable =org-start-notification-daemon-on-startup= to =t= as shown in the code
snippet above.

The notifications system can be configured via the =org-notify-add= function. An
explanation for how to use this function can be found in the initial comment of
the =org-notify.el= file (=SPC h d f org-notify-add RET o a=) and in the
function its docstring.

The =org-notify= package will scan through your =org-agenda-files= for =TODO=
headlines that include the =DEADLINE:= stamp. Press =M-S RET= to enter a todo
headline and then press =, d d= to add a deadline stamp to the headline. This
layer implements a configuration type named =default=. Org-notify automatically
applies this type to all =TODO= entries with a =DEADLINE:= stamp. To set a
custom notification type for an item add a =:NOTIFY:= property where its value
should be the name of a type that you have added via =org-notify-add= function
(see the explanation in the initial comment of the =org-notify.el=).

** GitHub support
To install GitHub related extensions like [[https://github.com/larstvei/ox-gfm][ox-gfm]] to export to GitHub
flavored markdown set the variable =org-enable-github-support= to =t=.
Expand Down
6 changes: 6 additions & 0 deletions layers/+emacs/org/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ path, one file per project is used (and the path is relative to
the project root). If it an absolute path, one global file is
used.")

(defvar org-enable-notifications nil
"If non-nil org-notify is configured.")

(defvar org-start-notification-daemon-on-startup nil
"If non-nil start the notification daemon on startup.")

(defvar org-enable-org-contacts-support nil
"If non-nil org-contacts is configured.")

Expand Down
15 changes: 15 additions & 0 deletions layers/+emacs/org/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
(ob :location built-in)
(org :location built-in)
(org-agenda :location built-in)
(org-notify :location built-in
:toggle org-enable-notifications)
(org-contacts :location built-in
:toggle org-enable-org-contacts-support)
(org-vcard :toggle org-enable-org-contacts-support)
Expand Down Expand Up @@ -588,6 +590,19 @@ Headline^^ Visit entry^^ Filter^^ Da
(kbd "M-SPC") 'spacemacs/org-agenda-transient-state/body
(kbd "s-M-SPC") 'spacemacs/org-agenda-transient-state/body)))

(defun org/init-org-notify ()
(use-package org-notify
:config
(org-notify-add 'default
'(:time "-1s" :period "20s" :duration 10
:actions (-message -ding))
'(:time "15m" :period "2m" :duration 100
:actions -notify)
'(:time "2h" :period "5m" :actions -message)
'(:time "3d" :actions -email))
(when org-start-notification-daemon-on-startup
(org-notify-start))))

(defun org/init-org-brain ()
(use-package org-brain
:defer t
Expand Down

0 comments on commit abd2f60

Please sign in to comment.