From 7c437a17ea6f522e9ba132695d85611e54c56de5 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 15 Aug 2023 13:49:46 +0200 Subject: emacs: Make frames transparent --- .config/emacs/config.org | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to '.config/emacs') 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 -- cgit v1.2.3