summaryrefslogtreecommitdiff
path: root/.config/emacs/config.org
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-08-15 13:49:46 +0200
committerThomas Voss <mail@thomasvoss.com> 2023-08-15 13:50:16 +0200
commit7c437a17ea6f522e9ba132695d85611e54c56de5 (patch)
treea81f0ec76e4f60068662d5edb1b580fee57f29f1 /.config/emacs/config.org
parent5213a6674b0546e5d2d5899f8a06d8e54b3b93bc (diff)
emacs: Make frames transparent
Diffstat (limited to '.config/emacs/config.org')
-rw-r--r--.config/emacs/config.org33
1 files changed, 33 insertions, 0 deletions
diff --git a/.config/emacs/config.org b/.config/emacs/config.org
index 31c3250..5824198 100644
--- a/.config/emacs/config.org
+++ b/.config/emacs/config.org
@@ -986,6 +986,39 @@ kill all buffers you were using in a frame before closing it.
#+END_SRC
+*** TODO 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."
+ (interactive "NOpacity: ")
+ (setopt mm-alpha-background val))
+
+ (add-hook 'after-make-frame-functions #'mm--set-frame-alpha-background)
+
+#+END_SRC
+
** Extra Modes
Some modes aren’t installed by default with Emacs, so let’s fetch them