ema2159 / centaur-tabs

Emacs plugin aiming to become an aesthetic, modern looking tabs plugin
GNU General Public License v3.0
749 stars 51 forks source link

Hiding dirvish-side tabs? #243

Open pupbrained opened 6 days ago

pupbrained commented 6 days ago

I'm using centaur-tabs and dirvish as a dired replacement, with dirvish-side. Right now I have the following config:

  (use-package centaur-tabs
    :ensure t
    :config
    (setq centaur-tabs-cycle-scope             'tabs
          centaur-tabs-height                  32
          centaur-tabs-icon-type               'nerd-icons
          centaur-tabs-left-edge-margin        nil
          centaur-tabs-set-bar                 'under
          centaur-tabs-set-close-button        nil
          centaur-tabs-set-icons               t
          centaur-tabs-set-modified-marker     t
          centaur-tabs-show-count              nil
          centaur-tabs-show-new-tab-button     t
          centaur-tabs-style                   "bar"
          x-underline-at-descent-line          t)
    (centaur-tabs-group-by-projectile-project)
    (centaur-tabs-mode t)
    (defun centaur-tabs-hide-tab (x)
      (let ((name (format "%s" x)))
        (or
          (window-dedicated-p (selected-window))
          (string-prefix-p "*" name)
          (string-prefix-p "magit" name)
          (derived-mode-p 'dired-mode))))
    :hook
    (dashboard-mode . centaur-tabs-local-mode)
    (treemacs-mode . centaur-tabs-local-mode)
    (spacemacs-buffer-mode . centaur-tabs-local-mode)
    (term-mode . centaur-tabs-local-mode)
    (calendar-mode . centaur-tabs-local-mode)
    (org-agenda-mode . centaur-tabs-local-mode)
    (helpful-mode . centaur-tabs-local-mode)
    (dired-mode . centaur-tabs-local-mode)
    (zone-mode . centaur-tabs-local-mode)
    (helm-mode . centaur-tabs-local-mode))

I'm not sure if I'm missing something, but once I've opened dirvish it persists in the tab bar no matter what I do. I just want to hide it in general.

jcs090218 commented 6 days ago

Can you try modifying the variable centaur-tabs-excluded-prefixes? 🤔

pupbrained commented 6 days ago

I'm not exactly sure what I would add to the variable, since the titles of dirvish tabs are always the name of the directory instead of something static.

jcs090218 commented 5 days ago

Ah, got it. How about centaur-tabs-hide-predicate? 🤔 Can it be detected with major mode or minor mode?

pupbrained commented 5 days ago

I tried:

(defun my/centaur-tabs-hide-predicate ()
  "Hide Centaur Tabs in `dired-mode` and `dirvish-mode`."
  (or (derived-mode-p 'dired-mode)
      (derived-mode-p 'dirvish-mode)))

(setq centaur-tabs-hide-predicate 'my/centaur-tabs-hide-predicate)

But again, no luck.