emacs.org: disable elcord if there are no frames
This commit is contained in:
parent
d566c57115
commit
8615f3f253
1 changed files with 22 additions and 8 deletions
|
@ -1080,14 +1080,28 @@ the feds are watching
|
||||||
#+end_src
|
#+end_src
|
||||||
** Elcord (Discord rich precense)
|
** Elcord (Discord rich precense)
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package elcord
|
(use-package elcord
|
||||||
:init
|
:init
|
||||||
(setq elcord-display-buffer-details nil)
|
(setq elcord-display-buffer-details nil)
|
||||||
(setq elcord-use-major-mode-as-main-icon t)
|
(setq elcord-use-major-mode-as-main-icon t)
|
||||||
(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)))
|
||||||
|
(add-hook 'elcord-mode-hook 'sakomacs/elcord-mode-hook)
|
||||||
|
|
||||||
|
(elcord-mode))
|
||||||
#+end_src
|
#+end_src
|
||||||
** Telegram
|
** Telegram
|
||||||
does NOT WORK ON WINDOWS
|
does NOT WORK ON WINDOWS
|
||||||
|
|
Loading…
Reference in a new issue