Skip to content

Commit

Permalink
Add alert category (#37)
Browse files Browse the repository at this point in the history
* Added alert :category support

* Renamed var to org-alert-notification-category; added readme
  • Loading branch information
anthonywilliams authored Jan 22, 2024
1 parent c4bcea4 commit b4bfd4c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ variable. Use this if you'd like to customize the display of org
notifications when using a daemon such as
[dunst](https://github.com/knopwob/dunst).

### Custom categories

org-alert uses the category `'org-alert` by default. You can set this to
something else by changing the `org-alert-notification-category`
variable. Use this if you'd like to customize the display of org
notifications when using a notification function that supports
distinct categories via the `alert` `:category` property.

### Custom regexp for searching agenda entries

org-alert searches for agenda entries with 'Sched' or 'Deadline' word
Expand Down
12 changes: 10 additions & 2 deletions org-alert.el
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ is used to extract the time")
"REMINDERN"
"org property used to set a custom cutoff for an individual entry")

(defvar org-alert-notification-category
'org-alert
"The symbol to pass to alert as the :category property, in order
to allow differentiation from other uses of alert")

(defun org-alert--read-subtree ()
"Return the current subtree as a string. Adapted from
`org-copy-subtree` from org-mode."
Expand Down Expand Up @@ -151,8 +156,11 @@ heading, the scheduled/deadline time, and the cutoff to apply"
(cl-destructuring-bind (head time cutoff) entry
(if time
(when (org-alert--check-time time cutoff)
(alert (concat time ": " head) :title org-alert-notification-title))
(alert head :title org-alert-notification-title))))))
(alert (concat time ": " head)
:title org-alert-notification-title
:category org-alert-notification-category))
(alert head :title org-alert-notification-title
:category org-alert-notification-category))))))

(defun org-alert-check ()
"Check for active, due deadlines and initiate notifications."
Expand Down

0 comments on commit b4bfd4c

Please sign in to comment.