Commit 6dc4c722 authored by Alex Murray's avatar Alex Murray Committed by Basil L. Contovounesios

Pop to originating erc buffer when clicking desktop notification

* lisp/erc/erc-desktop-notifications.el: Switch to lexical-binding.
(erc-notifications-notify): Add a default action to the desktop
notification which pops to the buffer from which the notification
originated.  (Bug#35141)

Copyright-paperwork-exempt: yes
parent 2b82c829
Pipeline #1255 failed with stage
in 49 minutes and 40 seconds
;; erc-desktop-notifications.el -- Send notification on PRIVMSG or mentions
;; erc-desktop-notifications.el -- Send notification on PRIVMSG or mentions -*- lexical-binding:t -*-
;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
......@@ -59,13 +59,19 @@
This will replace the last notification sent with this function."
(dbus-ignore-errors
(setq erc-notifications-last-notification
(let ((channel (current-buffer)))
(notifications-notify :bus erc-notifications-bus
:title (xml-escape-string nick)
:title (format "%s in %s"
(xml-escape-string nick)
channel)
:body (xml-escape-string msg)
:replaces-id erc-notifications-last-notification
:app-icon erc-notifications-icon))))
:app-icon erc-notifications-icon
:actions '("default" "Switch to buffer")
:on-action (lambda (&rest _)
(pop-to-buffer channel)))))))
(defun erc-notifications-PRIVMSG (proc parsed)
(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)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment