diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-08-15 22:18:51 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-08-15 22:18:51 +0200 |
commit | 0a3cc8f53c65cffebf75f2105a7a88ae6d181654 (patch) | |
tree | 1f4e99193d95f159618a9012620295c7fa9a7387 /.config | |
parent | c22aec07904e2a089b70d52d801a8887d0134bfe (diff) |
emacs: Fix transparency issues
Diffstat (limited to '.config')
-rw-r--r-- | .config/emacs/config.org | 31 |
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 |