aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaul Benencia <raul@thousandeyes.com>2024-12-20 09:39:47 -0800
committerRaul Benencia <raul@thousandeyes.com>2024-12-20 09:42:57 -0800
commit52497eb64d8cf01704963a7ce5037766a0864298 (patch)
treeb4ad29eea41a69f23ff428675a91028d7926893d
parent9900cf013511222e03aed453ba517c939d6f8cd3 (diff)
emacs: fix new frames decorations
-rw-r--r--.emacs.d/early-init.el27
-rw-r--r--.emacs.d/rul-emacs.org27
2 files changed, 38 insertions, 16 deletions
diff --git a/.emacs.d/early-init.el b/.emacs.d/early-init.el
index 4565a88..5a34cb3 100644
--- a/.emacs.d/early-init.el
+++ b/.emacs.d/early-init.el
@@ -4,19 +4,30 @@
(scroll-bar-mode -1)
;; Avoid initial flash of light.
-;; Inspired on prot-emacs-avoid-initial-flash-of-light.
-(setq mode-line-format nil)
-(set-face-attribute 'default nil :background "#000000" :foreground "#ffffff")
-(set-face-attribute 'mode-line nil :background "#000000" :foreground "#ffffff" :box 'unspecified)
+(defun prot-emacs-re-enable-frame-theme (_frame)
+ "Re-enable active theme, if any, upon FRAME creation.
+Add this to `after-make-frame-functions' so that new frames do
+not retain the generic background set by the function
+`prot-emacs-avoid-initial-flash-of-light'."
+ (when-let* ((theme (car custom-enabled-themes)))
+ (enable-theme theme)))
+
+(defun prot-emacs-avoid-initial-flash-of-light ()
+ "Avoid flash of light when starting Emacs, if needed.
+New frames are instructed to call `prot-emacs-re-enable-frame-theme'."
+ (setq mode-line-format nil)
+ (set-face-attribute 'default nil :background "#000000" :foreground "#ffffff")
+ (set-face-attribute 'mode-line nil :background "#000000" :foreground "#ffffff" :box 'unspecified)
+ (add-hook 'after-make-frame-functions #'prot-emacs-re-enable-frame-theme))
+
+(prot-emacs-avoid-initial-flash-of-light)
;; Do not resize when font size changes
(setq frame-resize-pixelwise t)
-;; By default, start maximized
+;; By default, start maximized, undecorated
(add-to-list 'default-frame-alist '(fullscreen . maximized))
-
-;; No need for titlebar
-(modify-frame-parameters nil '((undecorated . t)))
+(add-to-list 'default-frame-alist '(undecorated . t))
;; Name frames to ease switching between them
(add-hook 'after-init-hook (lambda () (set-frame-name "main")))
diff --git a/.emacs.d/rul-emacs.org b/.emacs.d/rul-emacs.org
index 8996900..e3a99a8 100644
--- a/.emacs.d/rul-emacs.org
+++ b/.emacs.d/rul-emacs.org
@@ -40,10 +40,23 @@ Customization of graphical aspects of Emacs, such as size, panels, etc.
(scroll-bar-mode -1)
;; Avoid initial flash of light.
-;; Inspired on prot-emacs-avoid-initial-flash-of-light.
-(setq mode-line-format nil)
-(set-face-attribute 'default nil :background "#000000" :foreground "#ffffff")
-(set-face-attribute 'mode-line nil :background "#000000" :foreground "#ffffff" :box 'unspecified)
+(defun prot-emacs-re-enable-frame-theme (_frame)
+ "Re-enable active theme, if any, upon FRAME creation.
+Add this to `after-make-frame-functions' so that new frames do
+not retain the generic background set by the function
+`prot-emacs-avoid-initial-flash-of-light'."
+ (when-let* ((theme (car custom-enabled-themes)))
+ (enable-theme theme)))
+
+(defun prot-emacs-avoid-initial-flash-of-light ()
+ "Avoid flash of light when starting Emacs, if needed.
+New frames are instructed to call `prot-emacs-re-enable-frame-theme'."
+ (setq mode-line-format nil)
+ (set-face-attribute 'default nil :background "#000000" :foreground "#ffffff")
+ (set-face-attribute 'mode-line nil :background "#000000" :foreground "#ffffff" :box 'unspecified)
+ (add-hook 'after-make-frame-functions #'prot-emacs-re-enable-frame-theme))
+
+(prot-emacs-avoid-initial-flash-of-light)
#+end_src
** Frame configuration
@@ -59,11 +72,9 @@ environment.
;; Do not resize when font size changes
(setq frame-resize-pixelwise t)
-;; By default, start maximized
+;; By default, start maximized, undecorated
(add-to-list 'default-frame-alist '(fullscreen . maximized))
-
-;; No need for titlebar
-(modify-frame-parameters nil '((undecorated . t)))
+(add-to-list 'default-frame-alist '(undecorated . t))
;; Name frames to ease switching between them
(add-hook 'after-init-hook (lambda () (set-frame-name "main")))
nihil fit ex nihilo