The Selected Window Accent Mode is an Emacs package designed to visually distinguish the currently selected window by applying a unique accent color to its fringes, mode line, header line, and margins.
There exist a few emacs packages that perform window highlighting but that don’t quite provide the feature set of selected-window-accent.
selected-window-accent focusses more on clearly but non-intrusively highlighting the currently selected/focussed window by highlighting aspects of the window border without having to modify the appearance of non-selected windows, hence more akin to a tiling window manager.
“This package provides a minor mode that indicates which buffer is currently active by dimming the faces in the other buffers.”
This is the closest in functionality to selected-window-accent, the difference being that dimmer dims non selected windows rather than accent the selected window.
dimmer can be used in conjunction and will complement selected-window-accent to further enhance the emphasizing of the selected window.
“This package provides a minor-mode to change the background colour of the non active window.”
It uses overlays to highlight non active windows, so is similar to dimmer but is less subtle in its highlighting mechanism and hasn’t been updated in excess of 10 years.
“This package lets you set a color-theme on a per-buffer basis.”
Unlike dimmer and hiwin this package isn’t related to the concept of a selected window but more of defining different themes for different windows to distinguish them.
“This package is designed to visually distinguish “real” buffers (i.e. file-visiting code buffers where you do most of your work) from “unreal” buffers (like popups, sidebars, log buffers, terminals, etc) by giving the latter a slightly different – often darker – background”
Unlike dimmer and hiwin this package isn’t related to the concept of a selected window but more of distinguishing between collections of IDE like elements within emacs.
Add the following to the emacs init for a tiling window manager feel (see image above):
(use-package selected-window-accent-mode
:vc (:fetcher github :repo "captainflasmr/selected-window-accent-mode")
:custom
(selected-window-accent-fringe-thickness 10)
(selected-window-accent-custom-color "#916941")
(selected-window-accent-mode-style 'tiling))
(selected-window-accent-mode 1)
Put the following into your emacs init file:
(use-package selected-window-accent-mode
:vc (:fetcher github :repo "captainflasmr/selected-window-accent-mode"))
- TODO (see roadmap below)
Download the `.el` file and place it in your Emacs `load-path`.
Then either manually load it or add it to your configuration to be loaded at startup.
(require 'selected-window-accent-mode)
Interactively Toggle the mode on and off M-x selected-window-accent-mode
Interactively change the current style M-x switch-selected-window-accent-style
which will present a completing-read
selection in the minibuffer
The styles that are currently supported :
- default
- tiling
- subtle
see roadmap below for a description.
Typically I have bound these two interactive functions to a new keymap where I keep all my emacs visual change functions.
(defvar my-win-keymap (make-sparse-keymap))
(global-set-key (kbd "M-o") my-win-keymap)
(define-key my-win-keymap (kbd "a") 'selected-window-accent-mode)
(define-key my-win-keymap (kbd "y") 'switch-selected-window-accent-style)
To enable the accent mode automatically upon starting Emacs, add the following line to your `.emacs` or `init.el` file:
(use-package selected-window-accent-mode
:vc (:fetcher github :repo "captainflasmr/selected-window-accent-mode")
:custom
(selected-window-accent-fringe-thickness 20)
(selected-window-accent-custom-color "goldenrod")
(selected-window-accent-mode-style 'default))
(selected-window-accent-mode 1)
This will accent the modeline only for the selected window with the goldenrod
color.
(setq selected-window-accent-fringe-thickness 6)
(setq selected-window-accent-custom-color "#4179b2")
(setq selected-window-accent-mode-style 'tiling)
(selected-window-accent-mode 1)
This will accent the full outline of the window with the color #4179b2 more akin to a tiling window manager.
(setq selected-window-accent-fringe-thickness 6)
(setq selected-window-accent-custom-color nil)
(setq selected-window-accent-mode-style 'tiling)
(selected-window-accent-mode 1)
This will accent the full outline of the window with the highlight
color taken from the current theme.
(setq selected-window-accent-fringe-thickness 20)
(setq selected-window-accent-custom-color nil)
(setq selected-window-accent-mode-style 'subtle)
(selected-window-accent-mode 1)
This will accent the modeline and just the left fringe and in this case be quite a pronounced thick accent.
These are the entries in the emacs help / documentation, at some stage I shall push-block these to the elisp file itsself to ensure consistency but for the moment I could need to source START END refactor my existing routine.
The thickness of the fringes in pixels.
This thickness is used when the `selected-window-accent-mode-style’ is either tiling or subtle.
Custom accent color for the selected window.
When set to a color, this color will override the default highlight face background color as the accent color for the selected window. Setting this to nil disables the custom color, reverting to the default behavior.
Mode variable for `selected-window-accent-mode’.
When non-nil, the `selected-window-accent-mode` is active, accenting the selected window according to the style defined in `selected-window-accent-mode-style`.
Current style for accenting the selected window.
The style determines how the selected window is visually distinguished from unselected ones.
- `default’: No special styling, uses the default Emacs appearance.
- `tiling’: Accentuates the fringes and mode line of the selected window with a thicker appearance, based on `selected-window-accent-fringe-thickness`.
- `subtle’: Adds a subtle accent to the selected window with minimal visual change.
The selected-window-accent-mode
is a global minor mode that you can toggle to enable or disable the accenting of the selected window.
When enabled, it distinguishes the selected window with a special accent color.
Two hooks are used to automatically update the window accents when the window configuration or state changes:
- window-configuration-change-hook
- window-state-change-hook
These are added when the selected-window-accent-mode
is enabled and removed when disabled.
____________________ roadmap ____________________
DOING add to MELPA
TODO Incorporate `mode-line-active’ and `mode-line-inactive’ somehow as this would make more sense especially in the ‘default mode.
TODO highlight selected tab with same accent color?
TODO header-line not shown on window split - I have a funny feeling this could be very difficult, if not impossible!
TODO restore modeline height when switching between modes
TODO adjust the not selected-window margin to avoid little window navigation. disruption, hence translating a fringe pixel width to a number of margin characters, not quite sure how I am going to do this yet.
TODO excess selected-window disruption in header-line. (not sure I can do much about this)
TODO define more custom variables:
- accent color saturation adjustment
- accent color darken adjustment
- accent color hue adjustment
- compensating margin
TODO define which theme face attribute to use as the main accent color
Currently the default is to use the `highlight’ face
WATCH possible overheads of updating visual elements for each window?
WATCH careful with removing header-line on all windows, for example magit commit window and probably some others may need to add some logic depending on mode.
See CHANGELOG.org