From ba231c8a41e36a00a019ba430ac309cbcf48e46f Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sat, 28 Jun 2025 17:28:02 +0200 Subject: [PATCH] Reduce display information in tab-bar Inspired by https://www.rahuljuliato.com/posts/emacs-tab-bar-groups, not aiming at replacing my tmux workflow, though. --- init.el | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/init.el b/init.el index 916ea50..63daf51 100644 --- a/init.el +++ b/init.el @@ -333,12 +333,35 @@ :init (setq server-log t)) (use-package tab-bar - :init (setq tab-bar-show t - tab-bar-format '(tab-bar-format-tabs - tab-bar-separator - ;; tab-bar-format-align-right - ;; current-time-string - ))) + :init (setopt tab-bar-show t + tab-bar-tab-hints t + tab-bar-close-button-show nil + tab-bar-new-button-show nil + tab-bar-auto-width nil + tab-bar-separator " | " + tab-bar-format '(tab-bar-format-tabs-groups + tab-bar-separator)) + :config (progn + + ;; Two display overrides inspired by + ;; https://www.rahuljuliato.com/posts/emacs-tab-bar-groups. + + (define-advice tab-bar-tab-name-format-hints (:around + (orig-fun name tab idx) + only-show-tab-number) + (ignore orig-fun tab) + (if tab-bar-tab-hints + (format "[%d]" idx) + name)) + + (define-advice tab-bar-tab-group-format-default (:around + (orig-fun tab idx &optional currentp) + only-show-group-name) + (ignore orig-fun idx) + (propertize (funcall tab-bar-tab-group-function tab) + 'face (if currentp + 'tab-bar-tab-group-current + 'tab-bar-tab-group-inactive))))) (use-package undo-tree :ensure t