From 3f6f9cf2d40e30bd284f711cf2f7f55fbe1f0ae4 Mon Sep 17 00:00:00 2001 From: Jacopo De Simoi Date: Sat, 16 Mar 2019 23:31:53 -0400 Subject: [PATCH] Active indicator for active window --- global.org | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/global.org b/global.org index e5bf85d..1048145 100644 --- a/global.org +++ b/global.org @@ -168,6 +168,29 @@ (cond ((equal s "-") "·") ((equal s "@") "@") (t s))))) + (defface mode-line-indicator + '((t nil)) + "mode-line active indicator" + :group 'mode-line-faces) + + (defface mode-line-inactive-indicator + '((t nil)) + "Inactive variant of indicator" + :group 'mode-line-faces) + + + ;; This has some issues when two buffers are shown in different windows + ;; There are some solutions but let us see if this works first + (defun mode-line-update-face (window) + "Update the `mode-line' face in WINDOW to indicate whether the window is selected." + (with-current-buffer (window-buffer window) + (if (eq (current-buffer) (window-buffer (selected-window))) + (face-remap-reset-base 'mode-line-indicator) + (face-remap-set-base 'mode-line-indicator (face-all-attributes 'mode-line-inactive-indicator))))) + + (add-hook 'buffer-list-update-hook (lambda () (walk-windows #'mode-line-update-face nil t))) + + (defvar wilder-buffer-vc-mode-line '("%b" (vc-mode (:propertize ;; Strip the backend name from the VC status information @@ -209,7 +232,7 @@ mode-line-frame-identification wilder-buffer-vc-mode-line " " wilder-position - " " + (:propertize " " face mode-line-indicator) wilder/mode-line-modes mode-line-misc-info mode-line-end-spaces))