Emacs: Don't reload the theme each time a frame is created.

Load the theme on init, fix the colors that need fixing when a frame is
created, stop if the code ran in a GUI frame before.
This commit is contained in:
tastytea 2020-12-05 08:58:46 +01:00
parent 8785bb905d
commit 8b94772e9a
1 changed files with 20 additions and 15 deletions

View File

@ -1,6 +1,6 @@
;;; appearance.el --- Configure appearance. -*- lexical-binding: t; -*- ;;; appearance.el --- Configure appearance. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-11-30T20:02:17+0100> ;; Time-stamp: <2020-12-05T08:55:31+0100>
;;; Commentary: ;;; Commentary:
@ -67,19 +67,24 @@
:custom ((doom-themes-treemacs-theme "doom-colors") :custom ((doom-themes-treemacs-theme "doom-colors")
(doom-themes-treemacs-enable-variable-pitch nil)) (doom-themes-treemacs-enable-variable-pitch nil))
:config (progn :config (progn
(defun my/reload-theme () (defvar my/run-fix-theme t)
(load-theme 'doom-outrun-electric t) (defun my/fix-theme ()
(when (display-graphic-p) "Fix some colors, needed the for the first frame after server start."
(set-face-background 'scroll-bar (face-background 'default)) (when my/run-fix-theme
(set-face-foreground 'scroll-bar (face-foreground 'shadow))) (when (display-graphic-p)
(when (fboundp #'my/ruler-set-colors) (set-face-background 'scroll-bar (face-background 'default))
(my/ruler-set-colors)) (set-face-foreground 'scroll-bar (face-foreground 'shadow)))
(when (fboundp #'my/volatile-highlights-reset-color) (when (fboundp #'my/ruler-set-colors)
(my/volatile-highlights-reset-color)) (my/ruler-set-colors))
(when (fboundp #'markdown-mode) (when (fboundp #'my/volatile-highlights-reset-color)
(set-face-background 'markdown-code-face (my/volatile-highlights-reset-color))
(face-background 'hl-line)))) (when (fboundp #'markdown-mode)
(my/reload-theme) (set-face-background 'markdown-code-face
(face-background 'hl-line)))
(when (display-graphic-p)
(setq my/run-fix-theme nil))))
(load-theme 'doom-outrun-electric t)
(my/fix-theme)
(doom-themes-visual-bell-config) ; Flash modeline on error. (doom-themes-visual-bell-config) ; Flash modeline on error.
;; No icons in TUI, see ;; No icons in TUI, see
@ -105,7 +110,7 @@
(set-window-fringes (selected-window) 8)) (set-window-fringes (selected-window) 8))
(advice-add #'doom-themes-hide-fringes-maybe (advice-add #'doom-themes-hide-fringes-maybe
:after #'my/treemacs-reset-fringe)) :after #'my/treemacs-reset-fringe))
:hook (server-after-make-frame . my/reload-theme)) :hook (server-after-make-frame . my/fix-theme))
;; Neat modeline. ;; Neat modeline.
(use-package doom-modeline (use-package doom-modeline