diff options
author | Matthew Lemon <y@yulqen.org> | 2024-07-07 14:10:21 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-07-07 14:10:21 +0100 |
commit | e39879eb57681dc16b48ea91584c82a6e59a0c8c (patch) | |
tree | 5cc59bab6b3ce179eeb45861b7538c41e1b6a9ab | |
parent | 7639f27ba6ad73749e764ca688a072723213b32f (diff) |
Adds code to keep font the same when switching themes
-rw-r--r-- | init.el | 41 |
1 files changed, 32 insertions, 9 deletions
@@ -224,16 +224,39 @@ Restart works only on graphic display." (setq visible-bell t) ;; font + ;; (cond - ;; ((string-equal (system-name) "schumann") - ;; (when (member "Iosevka Nerd Font" (font-family-list)) - ;; (add-to-list 'default-frame-alist '(font . "Iosevka Nerd Font")))) - ;; ((string-equal (system-name) "pop_os") - ;; (when (member "Hack" (font-family-list)) - ;; (add-to-list 'default-frame-alist '(font . "Hack-10")))) - -(add-to-list 'default-frame-alist - '(font . "Iosevka Nerd Font-14")) +;; ((string-equal (system-name) "schumann") +;; (when (member "Iosevka Nerd Font" (font-family-list)) +;; (add-to-list 'default-frame-alist '(font . "Iosevka Nerd Font")))) +;; ((string-equal (system-name) "pop_os") +;; (when (member "Hack" (font-family-list)) +;; (add-to-list 'default-frame-alist '(font . "Hack-10")))) + +;; (add-to-list 'default-frame-alist +;; '(font . "Iosevka Nerd Font-14")) + +(set-frame-font "Iosevka Nerd Font-14") +(defun my-set-default-font () + (set-frame-font "Iosevka Nerd Font-14" nil t)) + +;; Add the function to the `after-init-hook` so it's run after initialization +(add-hook 'after-init-hook 'my-set-default-font) + +;; Add the function to the `after-load-theme-hook` so it's run after loading a theme +(add-hook 'after-load-theme-hook 'my-set-default-font) + +(defun my-apply-font () + "Apply my preferred font settings." + (set-frame-font "Iosevka Nerd Font-14" nil t)) + +(add-hook 'after-make-frame-functions + (lambda (frame) + (with-selected-frame frame + (my-apply-font)))) + +;; Apply the font settings to the current frame +(my-apply-font) ;; (set-face-attribute 'default nil ;; :family "Iosevka Nerd Font" |