diff --git a/init.org b/init.org index c9bcb44..e019df6 100644 --- a/init.org +++ b/init.org @@ -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