summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/emacs/config.org31
1 files changed, 9 insertions, 22 deletions
diff --git a/.config/emacs/config.org b/.config/emacs/config.org
index 32a0b17..cd499a7 100644
--- a/.config/emacs/config.org
+++ b/.config/emacs/config.org
@@ -986,36 +986,23 @@ kill all buffers you were using in a frame before closing it.
#+END_SRC
-*** TODO Transparency
+*** Transparency
Transparency is totally useless, but it looks cool. Luckily transparent
background support was added in Emacs 29!
-TODO: Why doesn’t ~mm--set-frame-alpha-background~ get run automatically?
-
#+BEGIN_SRC elisp
- (defun mm--set-frame-alpha-background (&optional frame)
- "Set the background opacity of FRAME to ‘mm-alpha-background’. If FRAME is
- nil then the selected frame is used."
- (when (display-graphic-p)
- (set-frame-parameter frame 'alpha-background mm-alpha-background)))
-
- (defcustom mm-alpha-background 90
- "The opacity of a graphical Emacs frame, ranging from 0–100. This variable
- should customized via ‘setopt’ so that the correct setter gets executed. For
- interactive customization you can use ‘mm-set-alpha-background’."
- :type '(natnum)
- :set (lambda (symbol value)
- (set symbol value)
- (mm--set-frame-alpha-background)))
-
- (defun mm-set-alpha-background (val)
- "Set the current frames background opacity to VAL."
+ (defvar mm-alpha-background 90
+ "The opacity of a graphical Emacs frame, ranging from 0–100. A value of 0 is
+ fully transparent while a value of 100 is fully opaque.")
+
+ (defun mm-set-alpha-background (value)
+ "Set the current frames background opacity to VALUE."
(interactive "NOpacity: ")
- (setopt mm-alpha-background val))
+ (set-frame-parameter nil 'alpha-background value))
- (add-hook 'after-make-frame-functions #'mm--set-frame-alpha-background)
+ (add-to-list 'default-frame-alist (cons 'alpha-background mm-alpha-background))
#+END_SRC