Change the way we use Termux notifications
Since my PR in the alert package got merged, we no longer need this hack.
This commit is contained in:
parent
87b37aadbe
commit
bf4d26c1e3
@ -1758,37 +1758,26 @@ activate objed and enable its modal editing features.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package alert
|
||||
:config
|
||||
(setq alert-default-style
|
||||
(if (gpolonkai/termux-p)
|
||||
(progn
|
||||
;; TODO Remove this as soon as my PR gets merged
|
||||
;; https://github.com/jwiegley/alert/pull/41
|
||||
(unless (fboundp 'alert-termux-notify)
|
||||
(defcustom alert-termux-command (executable-find "termux-notification")
|
||||
"Path to the termux-notification command.
|
||||
This is found in the termux-api package, and it requires the Termux
|
||||
API addon app to be installed."
|
||||
:type 'file
|
||||
:group 'alert)
|
||||
(setq alert-default-style 'libnotify))
|
||||
#+end_src
|
||||
|
||||
(defun alert-termux-notify (info)
|
||||
"Send INFO using termux-notification.
|
||||
Handles :TITLE and :MESSAGE keywords from the
|
||||
INFO plist."
|
||||
(if alert-termux-command
|
||||
(let ((args (nconc
|
||||
(when (plist-get info :title)
|
||||
(list "-t" (alert-encode-string (plist-get info :title))))
|
||||
(list "-c" (alert-encode-string (plist-get info :message))))))
|
||||
(apply #'call-process alert-termux-command nil
|
||||
(list (get-buffer-create " *termux-notification output*") t)
|
||||
nil args))
|
||||
(alert-message-notify info)))
|
||||
Only send alerts from eshell when the buffer is not visible:
|
||||
|
||||
(alert-define-style 'termux :title "Notify using termux"
|
||||
:notifier #'alert-termux-notify))
|
||||
'termux)
|
||||
'libnotify)))
|
||||
#+begin_src emacs-lisp
|
||||
(alert-add-rule
|
||||
:status '(buried)
|
||||
:mode 'eshell-mode
|
||||
:style 'notifications)
|
||||
#+end_src
|
||||
|
||||
Send alerts to Termux if we are running there
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(when (gpolonkai/termux-p)
|
||||
(use-package alert-termux
|
||||
:after alert
|
||||
:config
|
||||
(setq alert-default-style 'termux)))
|
||||
#+end_src
|
||||
|
||||
** ~undo-tree~
|
||||
|
Loading…
x
Reference in New Issue
Block a user