Fix: set current window after switching window.

This commit is contained in:
Vincent Zhang 2018-06-21 18:31:16 +08:00
parent 14e4b8ba5a
commit 616fdabd8d

View file

@ -243,17 +243,17 @@ If STRICT-P, return nil if no project was found, otherwise return
(force-mode-line-update)) (force-mode-line-update))
(add-hook 'window-configuration-change-hook #'doom-modeline-set-selected-window) (add-hook 'window-configuration-change-hook #'doom-modeline-set-selected-window)
(add-hook 'doom-after-switch-window-hook #'doom-modeline-set-selected-window) (add-hook 'switch-window-finish-hook #'doom-modeline-set-selected-window)
(with-no-warnings (with-no-warnings
(if (not (boundp 'after-focus-change-function)) (if (not (boundp 'after-focus-change-function))
(progn (progn
(add-hook 'focus-in-hook #'doom-modeline-set-selected-window) (add-hook 'focus-in-hook #'doom-modeline-set-selected-window)
(add-hook 'focus-out-hook #'doom-modeline-unset-selected-window)) (add-hook 'focus-out-hook #'doom-modeline-unset-selected-window))
(defun doom-modeline-refresh-frame () (defun doom-modeline-refresh-frame ()
(setq +doom-modeline-current-window nil) (setq doom-modeline-current-window nil)
(cl-loop for frame in (frame-list) (cl-loop for frame in (frame-list)
if (eq (frame-focus-state frame) t) if (eq (frame-focus-state frame) t)
return (setq +doom-modeline-current-window (frame-selected-window frame))) return (setq doom-modeline-current-window (frame-selected-window frame)))
(force-mode-line-update)) (force-mode-line-update))
(add-function :after after-focus-change-function #'doom-modeline-refresh-frame))) (add-function :after after-focus-change-function #'doom-modeline-refresh-frame)))