diff --git a/ui.el b/ui.el
index 3ab07d5..b4cf5f3 100644
--- a/ui.el
+++ b/ui.el
@@ -98,7 +98,9 @@
(setq tab-bar-close-button-show nil) ;; hide tab close / X button
(setq tab-bar-new-tab-choice "*enlight*");; buffer to show in new tabs
(setq tab-bar-tab-hints t) ;; show tab numbers
- (setq tab-bar-format '(tab-bar-format-tabs tab-bar-separator))) ;; elements to include in bar
+ (setq tab-bar-format '(tab-bar-format-tabs tab-bar-separator)) ;; elements to include in bar
+ (defvar tab-bar-select-tab-hook nil "Hook for `tab-bar-select-tab'")
+ (advice-add 'tab-bar-select-tab :after (lambda (x) (run-hooks 'tab-bar-select-tab-hook))))
;; Hideshow
(add-hook 'prog-mode-hook #'hs-minor-mode)
diff --git a/userland/flycheck_dired-custom.el b/userland/flycheck_dired-custom.el
deleted file mode 100644
index f684798..0000000
--- a/userland/flycheck_dired-custom.el
+++ /dev/null
@@ -1,104 +0,0 @@
-;;; dired-custom.el --- Custom dired config -*- lexical-binding: t -*-
-
-;; This file is not part of GNU Emacs
-
-;; This program is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program. If not, see .
-
-
-;;; Commentary:
-
-;; commentary
-
-;;; Code:
-
-(require 'dired)
-
-(setq dired-listing-switches "-lh")
-(setq dired-recursive-deletes t)
-(setq dired-recursive-copies t)
-
-(defun dired-init ()
- "Theurgy Dired config."
- ;; Hide file permissions
- (dired-hide-details-mode 1)
- ;; Kill new buffers
- (when (>= emacs-major-version 28)
- (setq dired-kill-when-opening-new-dired-buffer t))
- (when (< emacs-major-version 28)
- (progn
- (define-key dired-mode-map (kbd "RET") 'dired-find-alternate-file)
- (define-key dired-mode-map (kbd "^") (lambda () (interactive) (find-alternate-file "..")))))
- ;; Human readable file size
- (setq dired-listing-switches "-lh"))
-
-(add-hook 'dired-mode-hook 'dired-init)
-(add-hook 'dired-mode-hook 'auto-revert-mode)
-
-;; Icons in dired
-(use-package all-the-icons-dired
- :config
- (add-hook 'dired-mode-hook 'all-the-icons-dired-mode))
-
-;; Multimedia and PDF viewing
-(when (not (equal system-type 'windows-nt))
- (use-package ready-player
- :ensure t
- :config
- (setq ready-player-autoplay nil)
- (ready-player-mode 1))
-
- (use-package pdf-tools
- :config (pdf-loader-install)))
-
-
-;; Preview files
-(defun dired-preview-to-the-right ()
- "My preferred `dired-preview-display-action-alist-function'."
- '((display-buffer-in-side-window)
- (side . right)
- (slot . 0)
- (window-width . 0.3)))
-
-(use-package dired-preview
- :after (ready-player)
- :config
- (setq dired-preview-display-action-alist #'dired-preview-to-the-right)
- (setq dired-preview-buffer-name-indicator "[Preview]")
- (setq dired-preview-ignored-extensions-regexp
- (concat "\\."
- "\\(gz\\|"
- "zst\\|"
- "tar\\|"
- "xz\\|"
- "rar\\|"
- "zip\\|"
- "iso\\|"
- "epub"
- "\\)"))
- (dired-preview-global-mode 1))
-
-;; Automatically kill preview buffers when opening a file
-(add-hook 'find-file-hook (lambda ()
- (dolist (buf (buffer-list))
- (when (string-match-p "\\[Preview\\]" (buffer-name buf))
- (kill-buffer buf)))))
-
-(use-package neotree
- :config
- (define-key global-map (kbd "") 'neotree-toggle)
- (setq neo-theme (if (display-graphic-p) 'icons 'arrow)))
-
-(provide 'dired-custom)
-
-;;; dired-custom.el ends here
diff --git a/userland/projects.el b/userland/projects.el
index 08ba049..315feb6 100644
--- a/userland/projects.el
+++ b/userland/projects.el
@@ -49,8 +49,17 @@
(whaler :action (lambda (dir)
(find-file (get-project-default-file dir))
(tab-rename (file-name-nondirectory (string-remove-suffix "/" dir)))
+ (tab-bar-change-tab-group (concat "project: " dir))
(neotree-dir dir))))
+(defun theurgy-swap-to-tab-project ()
+ "Go to the project dir of the tab group."
+ (let ((tab-group-name (tab-bar-tab-group-default (tab-bar--current-tab))))
+ (when (string-match-p "^project:" tab-group-name)
+ (neotree-dir (string-remove-prefix "project: " tab-group-name)))))
+
+(add-hook 'tab-bar-select-tab-hook #'theurgy-swap-to-tab-project)
+
(defun theurgy-edit-projects-list ()
"Open list of projects in customize."
(interactive)