aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-25 09:25:32 -0500
committerCraig Jennings <c@cjennings.net>2026-05-25 09:25:32 -0500
commit56da3d940b26a51102bce39b3b82dfbbc2b391fd (patch)
tree54ce4e57ef954835ccc0fb7ebdb51a5c7c68f59b /modules
parenta522e5537ab9c94a45656b28e94a73b98f47d4b8 (diff)
downloaddotemacs-56da3d940b26a51102bce39b3b82dfbbc2b391fd.tar.gz
dotemacs-56da3d940b26a51102bce39b3b82dfbbc2b391fd.zip
feat(auto-dim): dim non-selected windows via auto-dim-other-buffers
I added auto-dim-config, a module that loads my local auto-dim-other-buffers fork and dims windows that don't have focus so the selected window stands out. A non-selected window drops to a pure-black background with faded gray text. The dimmed faces live in the dupre theme (themes/dupre-faces.el) so they track theme switches, and the module remaps default, the font-lock faces, and org-block onto them so syntax-highlighted code fades too rather than staying lit. Fringe is left out because dimming it forces a full-frame refresh that flickers on this non-pgtk build. dim-on-focus-out is nil, so tabbing to a browser or terminal on Hyprland doesn't dim the whole frame. vterm and agent windows don't dim either, because the terminal paints its own per-cell colors past the face remap. I'm keeping that, since the agent's output stays readable while I work in code on the other side. The module loads after the theme, carries a load-graph header, joins the header-contract allowlist, and the inventory moves to 103 of 103 classified.
Diffstat (limited to 'modules')
-rw-r--r--modules/auto-dim-config.el61
1 files changed, 61 insertions, 0 deletions
diff --git a/modules/auto-dim-config.el b/modules/auto-dim-config.el
new file mode 100644
index 00000000..83c5b17c
--- /dev/null
+++ b/modules/auto-dim-config.el
@@ -0,0 +1,61 @@
+;;; auto-dim-config.el --- Dim non-selected windows -*- lexical-binding: t; coding: utf-8; -*-
+;; author Craig Jennings <c@cjennings.net>
+;;
+;;; Commentary:
+;;
+;; Layer: 2 (Core UX).
+;; Category: C/O.
+;; Load shape: eager.
+;; Eager reason: global UI minor mode; the dimming should be visible in the
+;; first frame.
+;; Top-level side effects: enables auto-dim-other-buffers-mode and edits
+;; auto-dim-other-buffers-affected-faces.
+;; Runtime requires: none (loads the auto-dim-other-buffers fork via use-package).
+;; Direct test load: conditional (needs the ~/code fork on the load-path).
+;;
+;; Dims windows that do not have focus so the selected window stands out,
+;; using a local fork of auto-dim-other-buffers (the fork adds a focus-change
+;; debounce). The dimmed faces (auto-dim-other-buffers and
+;; auto-dim-other-buffers-hide) live in the active theme
+;; (themes/dupre-faces.el) so they track theme switches.
+
+;;; Code:
+
+(use-package auto-dim-other-buffers
+ :load-path "~/code/auto-dim-other-buffers.el"
+ :ensure nil
+ ;; :vc (:url "git@cjennings.net:auto-dim-other-buffers.git" :rev :newest)
+ :custom
+ ;; Dim only non-selected windows within Emacs, not the whole frame when
+ ;; Emacs loses focus -- on Hyprland focus moves to other apps constantly,
+ ;; and the ai-vterm agents live in their own windows.
+ (auto-dim-other-buffers-dim-on-focus-out nil)
+ (auto-dim-other-buffers-dim-on-switch-to-minibuffer t)
+ :config
+ ;; Remap these faces to auto-dim-other-buffers (pure-black background +
+ ;; faded gray foreground, defined in the theme) in non-selected windows.
+ ;; The font-lock faces are included so code text fades to "disabled"
+ ;; rather than staying lit -- remapping default alone would leave
+ ;; syntax-highlighted text at full colour. Fringe is left out because
+ ;; dimming it forces a full-frame refresh that flickers on this non-pgtk
+ ;; build; org-hide uses the -hide face so hidden text stays hidden.
+ (setq auto-dim-other-buffers-affected-faces
+ '((default . (auto-dim-other-buffers . nil))
+ (org-block . (auto-dim-other-buffers . nil))
+ (org-hide . (auto-dim-other-buffers-hide . nil))
+ (font-lock-keyword-face . (auto-dim-other-buffers . nil))
+ (font-lock-string-face . (auto-dim-other-buffers . nil))
+ (font-lock-comment-face . (auto-dim-other-buffers . nil))
+ (font-lock-comment-delimiter-face . (auto-dim-other-buffers . nil))
+ (font-lock-doc-face . (auto-dim-other-buffers . nil))
+ (font-lock-function-name-face . (auto-dim-other-buffers . nil))
+ (font-lock-variable-name-face . (auto-dim-other-buffers . nil))
+ (font-lock-type-face . (auto-dim-other-buffers . nil))
+ (font-lock-constant-face . (auto-dim-other-buffers . nil))
+ (font-lock-builtin-face . (auto-dim-other-buffers . nil))
+ (font-lock-preprocessor-face . (auto-dim-other-buffers . nil))
+ (font-lock-warning-face . (auto-dim-other-buffers . nil))))
+ (auto-dim-other-buffers-mode 1))
+
+(provide 'auto-dim-config)
+;;; auto-dim-config.el ends here