From 0feb1c1499953222a2de768b7c8bf73517c4e828 Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Sun, 27 Jan 2019 05:57:53 +0800 Subject: [PATCH] Fix #103: Segments sometimes get stuck with inactive face. Select current window, but should exclude the child windows. --- doom-modeline-core.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/doom-modeline-core.el b/doom-modeline-core.el index 5b3967a..4f1d40f 100644 --- a/doom-modeline-core.el +++ b/doom-modeline-core.el @@ -344,10 +344,16 @@ If DEFAULT is non-nil, set the default mode-line for all buffers." (eldoc-in-minibuffer-mode 1) ;; Keep `doom-modeline-current-window' up-to-date -(defvar doom-modeline-current-window (frame-selected-window)) +(defun doom-modeline--get-current-window () + "Get the current window but should exclude the child windows." + (if (and (fboundp 'frame-parent) (frame-parent)) + (frame-selected-window (frame-parent)) + (frame-selected-window))) + +(defvar doom-modeline-current-window (doom-modeline--get-current-window)) (defun doom-modeline-set-selected-window (&rest _) "Set `doom-modeline-current-window' appropriately." - (when-let ((win (frame-selected-window))) + (when-let ((win (doom-modeline--get-current-window))) (unless (minibuffer-window-active-p win) (setq doom-modeline-current-window win) (force-mode-line-update))))