diff options
| -rw-r--r-- | lisp/erc/erc-desktop-notifications.el | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lisp/erc/erc-desktop-notifications.el b/lisp/erc/erc-desktop-notifications.el index 56b93925ced..41b7420320c 100644 --- a/lisp/erc/erc-desktop-notifications.el +++ b/lisp/erc/erc-desktop-notifications.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;; erc-desktop-notifications.el -- Send notification on PRIVMSG or mentions | 1 | ;; erc-desktop-notifications.el -- Send notification on PRIVMSG or mentions -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2012-2019 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2012-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -59,13 +59,19 @@ | |||
| 59 | This will replace the last notification sent with this function." | 59 | This will replace the last notification sent with this function." |
| 60 | (dbus-ignore-errors | 60 | (dbus-ignore-errors |
| 61 | (setq erc-notifications-last-notification | 61 | (setq erc-notifications-last-notification |
| 62 | (notifications-notify :bus erc-notifications-bus | 62 | (let ((channel (current-buffer))) |
| 63 | :title (xml-escape-string nick) | 63 | (notifications-notify :bus erc-notifications-bus |
| 64 | :body (xml-escape-string msg) | 64 | :title (format "%s in %s" |
| 65 | :replaces-id erc-notifications-last-notification | 65 | (xml-escape-string nick) |
| 66 | :app-icon erc-notifications-icon)))) | 66 | channel) |
| 67 | 67 | :body (xml-escape-string msg) | |
| 68 | (defun erc-notifications-PRIVMSG (proc parsed) | 68 | :replaces-id erc-notifications-last-notification |
| 69 | :app-icon erc-notifications-icon | ||
| 70 | :actions '("default" "Switch to buffer") | ||
| 71 | :on-action (lambda (&rest _) | ||
| 72 | (pop-to-buffer channel))))))) | ||
| 73 | |||
| 74 | (defun erc-notifications-PRIVMSG (_proc parsed) | ||
| 69 | (let ((nick (car (erc-parse-user (erc-response.sender parsed)))) | 75 | (let ((nick (car (erc-parse-user (erc-response.sender parsed)))) |
| 70 | (target (car (erc-response.command-args parsed))) | 76 | (target (car (erc-response.command-args parsed))) |
| 71 | (msg (erc-response.contents parsed))) | 77 | (msg (erc-response.contents parsed))) |