correctly apply fonts in --bg-daemon mode

This commit is contained in:
Janis 2024-12-29 04:24:30 +01:00
parent d9f7ec85f5
commit 725cbf9260

View file

@ -319,6 +319,18 @@ Font size [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Face-Attri
#+end_src
#+begin_src emacs-lisp
(defun apply-if-gui (&rest action)
"apply ACTION if emacs is run in GUI context, regardless of daemonp or display-graphic-p"
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(select-frame frame)
(if (display-graphic-p frame)
(apply action))))
(if (display-graphic-p)
(apply action))))
(set-face-attribute 'default nil :font "monospace" :height nemo/font-height-mono)
(set-face-attribute 'fixed-pitch nil :font "monospace" :height nemo/font-height-mono)
(set-face-attribute 'variable-pitch nil :font "sans-serif" :height nemo/font-height-sans)
@ -326,13 +338,18 @@ Font size [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Face-Attri
;; (when (member "SF Mono" (font-family-list))
;; (set-face-attribute 'default nil :font "SF Mono" :height nemo/font-height-mono)
;; (set-face-attribute 'fixed-pitch nil :family "SF Mono" :height nemo/font-height-mono))
(defvar nemo/nerd-fonts-font "Symbols Nerd Font")
(when (member nemo/nerd-fonts-font (font-family-list))
(set-fontset-font t nil (font-spec :height nemo/font-height-mono :font "Symbols Nerd Font")))
(when (member "SF Pro Text" (font-family-list))
(set-face-attribute 'variable-pitch nil :family "SF Pro Text" :height nemo/font-height-sans))
(defvar nemo/nerd-fonts-font "Symbols Nerd Font")
(defun nemo/set-fallback-fonts ()
"Set fallback fonts for icons/symbols."
(when (member nemo/nerd-fonts-font (font-family-list))
(set-fontset-font t nil (font-spec :height nemo/font-height-mono :font "Symbols Nerd Font")))
)
(apply-if-gui #'nemo/set-fallback-fonts)
#+end_src
Use nerd-icons and apple emojis