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))