feat(workspaces): make tab-bar tabs workspace-local
This commit is contained in:
parent
aac3c15cde
commit
191745424b
2 changed files with 21 additions and 1 deletions
|
@ -572,6 +572,20 @@ This be hooked to `projectile-after-switch-project-hook'."
|
||||||
(run-hooks 'projectile-after-switch-project-hook)
|
(run-hooks 'projectile-after-switch-project-hook)
|
||||||
(setq +workspaces--project-dir nil)))))
|
(setq +workspaces--project-dir nil)))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +workspaces-save-tab-bar-data-h (_)
|
||||||
|
"Save the current workspace's tab bar data."
|
||||||
|
(when (get-current-persp)
|
||||||
|
(set-persp-parameter
|
||||||
|
'tab-bar-tabs (tab-bar-tabs))
|
||||||
|
(set-persp-parameter 'tab-bar-closed-tabs tab-bar-closed-tabs)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +workspaces-load-tab-bar-data-h (_)
|
||||||
|
"Restores the tab bar data of the workspace we have just switched to."
|
||||||
|
(tab-bar-tabs-set (persp-parameter 'tab-bar-tabs))
|
||||||
|
(setq tab-bar-closed-tabs (persp-parameter 'tab-bar-closed-tabs))
|
||||||
|
(tab-bar--update-tab-bar-lines t))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Advice
|
;;; Advice
|
||||||
|
|
|
@ -276,4 +276,10 @@ stored in `persp-save-dir'.")
|
||||||
(when (get-buffer buffer-name)
|
(when (get-buffer buffer-name)
|
||||||
(setq buffer-name (generate-new-buffer-name buffer-name)))
|
(setq buffer-name (generate-new-buffer-name buffer-name)))
|
||||||
(make-indirect-buffer base-buffer buffer-name t)))))
|
(make-indirect-buffer base-buffer buffer-name t)))))
|
||||||
(setq +workspaces--indirect-buffers-to-restore nil))))
|
(setq +workspaces--indirect-buffers-to-restore nil)))
|
||||||
|
|
||||||
|
;;; tab-bar
|
||||||
|
(add-hook! 'tab-bar-mode-hook
|
||||||
|
(defun +workspaces-set-up-tab-bar-integration-h ()
|
||||||
|
(add-hook 'persp-before-deactivate-functions #'+workspaces-save-tab-bar-data-h)
|
||||||
|
(add-hook 'persp-activated-functions #'+workspaces-load-tab-bar-data-h))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue