Skip to content

Commit

Permalink
feat: Refresh tabs on focus
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Jul 2, 2024
1 parent 7d9da4b commit 062e50f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions centaur-tabs-functions.el
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,12 @@ current cached copy."
(centaur-tabs-set-template centaur-tabs-tabsets-tabset nil)
centaur-tabs-tabsets-tabset)

(defun centaur-tabs-after-focus (&rest _)
"Focus hook."
(when (frame-focus-state)
(centaur-tabs-buffer-update-groups)
(centaur-tabs-display-update)))

(defun centaur-tabs-on-window-buffer-change (&rest _)
"Function to be run after window buffer is changed."
(centaur-tabs-buffer-update-groups))
Expand Down
2 changes: 2 additions & 0 deletions centaur-tabs.el
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ Run as `centaur-tabs-init-hook'."
(set-face-attribute 'centaur-tabs-unselected-modified nil
:overline nil
:underline nil))
(add-function :after after-focus-change-function #'centaur-tabs-after-focus)
(add-hook 'window-buffer-change-functions #'centaur-tabs-on-window-buffer-change)
(add-hook 'after-save-hook #'centaur-tabs-on-saving-buffer)
(add-hook 'first-change-hook #'centaur-tabs-on-modifying-buffer)
Expand All @@ -212,6 +213,7 @@ Run as `centaur-tabs-quit-hook'."
centaur-tabs-current-tabset-function nil
centaur-tabs-tab-label-function nil
centaur-tabs-select-tab-function nil)
(remove-function after-focus-change-function #'centaur-tabs-after-focus)
(remove-hook 'window-buffer-change-functions #'centaur-tabs-on-window-buffer-change)
(remove-hook 'after-save-hook 'centaur-tabs-on-modifying-buffer)
(remove-hook 'first-change-hook 'centaur-tabs-on-modifying-buffer)
Expand Down

0 comments on commit 062e50f

Please sign in to comment.