I am trying to configure ERC to give me a desktop notification when any message is sent in particular channels.
I looked through the code of both erc-desktop-notifications.el
and erc-notify.el
and neither of these packages support this feature.
It seems that I could potentially edit the erc-notifications-PRIVMSG
function from erc-desktop-notifications.el
to add the desired feature, however I am not able to figure out how to detect the current channel name from this function.
I was wondering if anybody knows of a way that this can be done.
Here is the definition of erc-notifications-PRIVMSG
:
(defun erc-notifications-PRIVMSG (_proc parsed)
(let ((nick (car (erc-parse-user (erc-response.sender parsed))))
(target (car (erc-response.command-args parsed)))
(msg (erc-response.contents parsed)))
(when (and (erc-current-nick-p target)
(not (and (boundp 'erc-track-exclude)
(member nick erc-track-exclude)))
(not (erc-is-message-ctcp-and-not-action-p msg)))
(erc-notifications-notify nick msg t)))
;; Return nil to continue processing by ERC
nil)
(please note this is cross-posted from reddit)