Thursday, October 29, 2026

Highlight Active Emacs Window

In https://emacs.stackexchange.com/a/36240/47342, CodyChan provides a few options "to better distinguish between focused window." But the one I like best is highlight-selected-window, which, rather than highlighting the selected window, changes the background color of all the unselected windows. The effect is that the active window stands out in comparison to the others.

The especially neat thing about this solution is that when the minibuffer is active, the background of all the windows is altered. So it's obvious even when Emacs is expecting input -- something I often miss.

I've changed the color of the buffer-face-set background from "#111" (sienna4) to "antiquewhite2" because I still need to read the content of inactive windows. The original color is too dark.

Demonstration of highlight-selected-window

I've also adopted flash-active-buffer, which sets the background color of the active window temporarily. I changed the color to palegreen just because. I use s-? as a keybinding. It's a bit awkward, but it's as if I use "?" to ask, "Where am I?" The function highlight-selected-window works so well that I don't think I'll need flash-active-buffer.

The color names that Emacs understands are stored in color-name-rgb-alist.

See also https://www.color-hex.com/color-names.html, but note that Emacs does not support every color name listed here.

No comments:

Post a Comment

Thank you for taking time to comment. Please note that comments may be deleted if they:

* Contain link(s) to a domain outside USA or Canada or to a commercial enterprise.
* Include non-English words or characters.
* Are irrelevant to the subject matter of the post.

For posts older than 14 days, comments are moderated and require approval.