emacs.org: disable elcord if there are no frames

This commit is contained in:
Sakooooo 2024-11-24 09:12:29 +04:00
parent d566c57115
commit 8615f3f253
Signed by: sako
GPG key ID: FE52FD65B76E4751

View file

@ -1087,6 +1087,20 @@ the feds are watching
(setq elcord-quiet t)
(setq elcord-display-elapsed nil)
:config
(defun elcord--disable-elcord-if-no-frames (f)
(ignore f)
(when (let ((frames (delete f (visible-frame-list))))
(or (null frames)
(elcord-mode -1)))
(defun elcord--enable-on-frame-created (f)
(elcord-mode +1))
(add-hook 'after-make-frame-functions 'elcord--enable-on-frame-created)
(defun sakomacs/elcord-mode-hook ()
(if elcord-mode
(add-hook 'delete-frame-functions 'elcord--disable-elcord-if-no-frames)
(remove-hook 'delete-frame-functions 'elcord--disable-elcord-if-no-frames)))
(add-hook 'elcord-mode-hook 'sakomacs/elcord-mode-hook)
(elcord-mode))
#+end_src
** Telegram