summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.org54
1 files changed, 54 insertions, 0 deletions
diff --git a/init.org b/init.org
index d343b91..ea88ad8 100644
--- a/init.org
+++ b/init.org
@@ -248,6 +248,60 @@ Customize the mode line:
"profiler" "selection-info" "narrow" "macro"))))
#+END_SRC
+Dim windows that are not active.
+
+#+begin_src elisp
+(use-package dimmer
+ :ensure
+ :defer
+ :init
+ (setq dimmer-watch-frame-focus-events nil)
+ (setq dimmer-use-colorspace :rgb)
+ (setq dimmer-fraction 0.1)
+ (setq dimmer-adjustment-mode :foreground)
+
+ (defun advise-dimmer-config-change-handler ()
+ "Advise to only force process if no predicate is truthy."
+ (let ((ignore (cl-some (lambda (f) (and (fboundp f) (funcall f)))
+ dimmer-prevent-dimming-predicates)))
+ (unless ignore
+ (when (fboundp 'dimmer-process-all)
+ (dimmer-process-all t)))))
+
+ (defun corfu-frame-p ()
+ "Check if the buffer is a corfu frame buffer."
+ (string-match-p "\\` \\*corfu" (buffer-name)))
+
+ (defun dimmer-configure-corfu ()
+ "Convenience settings for corfu users."
+ (add-to-list
+ 'dimmer-prevent-dimming-predicates
+ #'corfu-frame-p))
+
+ (defun update-dimmer-style ()
+ (let* ((theme (modus-themes--current-theme))
+ (what (pcase theme
+ ('modus-operandi 'light)
+ ('modus-operandi-tinted 'light)
+ (_ 'dark))))
+ (if (eq what 'dark)
+ (progn
+ (setq dimmer-fraction 0.3)
+ (setq dimmer-adjustment-mode :foreground))
+ (progn
+ (setq dimmer-fraction 0.05)
+ (setq dimmer-adjustment-mode :background)))))
+
+ (add-hook 'modus-themes-after-load-theme-hook
+ #'update-dimmer-style)
+ :config
+ (advice-add
+ 'dimmer-config-change-handler
+ :override 'advise-dimmer-config-change-handler)
+ (dimmer-configure-corfu)
+ (dimmer-mode t))
+#+end_src
+
* Default fonts
I like pretty faces. For coding I like to use the DejaVu Sans Mono font. In =org-mode= and in =eww= I like to use a font with variable pitch instead of the default mono-spaced font.