emacs.org: disable elcord if no frames take two

This commit is contained in:
Sakooooo 2024-11-24 09:41:35 +04:00
parent 096b004e76
commit 4e4d3dfb5d
Signed by: sako
GPG key ID: FE52FD65B76E4751

View file

@ -1087,7 +1087,24 @@ the feds are watching
(setq elcord-quiet t) (setq elcord-quiet t)
(setq elcord-display-elapsed nil) (setq elcord-display-elapsed nil)
:config :config
(elcord-mode)) (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)))
(elcord-mode)
(add-hook 'elcord-mode-hook 'sakomacs/elcord-mode-hook)
)
#+end_src #+end_src
** Telegram ** Telegram
does NOT WORK ON WINDOWS does NOT WORK ON WINDOWS