From f8d48cc50badb8a98f4fd6e0dfaf0beeb9f30eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Benencia?= Date: Mon, 31 Jul 2023 09:39:53 -0700 Subject: emacs: tab-bar revamp in rul-wm --- .emacs.d/init.el | 2 +- .emacs.d/rul-init.d/tabbar.el | 22 -------------------- .emacs.d/rul-lisp/packages/rul-wm.el | 40 ++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 23 deletions(-) delete mode 100644 .emacs.d/rul-init.d/tabbar.el create mode 100644 .emacs.d/rul-lisp/packages/rul-wm.el (limited to '.emacs.d') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 5d5c0c4..d3c8a19 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -159,6 +159,7 @@ (require 'rul-org) (require 'rul-org-roam) (require 'rul-write) +(require 'rul-wm) (load-file "~/.emacs.d/rul-init.d/fonts.el") (load-file "~/.emacs.d/rul-init.d/themes.el") @@ -179,7 +180,6 @@ (load-file "~/.emacs.d/rul-init.d/magit.el") (load-file "~/.emacs.d/rul-init.d/notmuch.el") (load-file "~/.emacs.d/rul-init.d/projectile.el") -(load-file "~/.emacs.d/rul-init.d/tabbar.el") (load-file "~/.emacs.d/rul-init.d/which-key.el") (load-file "~/.emacs.d/rul-init.d/writeroom.el") (load-file "~/.emacs.d/rul-init.d/vterm.el") diff --git a/.emacs.d/rul-init.d/tabbar.el b/.emacs.d/rul-init.d/tabbar.el deleted file mode 100644 index 3025828..0000000 --- a/.emacs.d/rul-init.d/tabbar.el +++ /dev/null @@ -1,22 +0,0 @@ -(global-set-key (kbd "C-") 'tab-bar-switch-to-next-tab) -(global-set-key (kbd "C-") 'tab-bar-switch-to-prev-tab) - -(setq tab-bar-show t) - -(defun my/project-create-tab () - (interactive) - (tab-bar-new-tab) - (magit-status)) - -(setq project-switch-commands #'my/project-create-tab) - -(defun my/switch-to-tab-buffer () - (interactive) - (if (project-current) - (call-interactively #'projectile-switch-to-buffer) - (call-interactively #'switch-to-buffer))) - -(global-set-key (kbd "C-x b") #'my/switch-to-tab-buffer) - -;; Turn on tab bar mode after startup -(tab-bar-mode 1) diff --git a/.emacs.d/rul-lisp/packages/rul-wm.el b/.emacs.d/rul-lisp/packages/rul-wm.el new file mode 100644 index 0000000..7b44163 --- /dev/null +++ b/.emacs.d/rul-lisp/packages/rul-wm.el @@ -0,0 +1,40 @@ +;; Inspiration: https://christiantietze.de/posts/2022/12/updated-org-mode-agenda-display-buffer-alist/ +(defun rul/display-buffer-org-agenda-managed-p (buffer-name action) + "Determine whether BUFFER-NAME is an org-agenda managed buffer." + (with-current-buffer buffer-name + (or (derived-mode-p 'org-mode 'org-agenda-mode) + (member (buffer-file-name) (org-agenda-files))))) + +(add-to-list 'display-buffer-alist + `("\\*Org Agenda\\*" + (display-buffer-in-tab ;; Make sure to use the "Org Files" tab + display-buffer-reuse-mode-window) + (ignore-current-tab . t) + (tab-name . "Org") + (dedicated . side) ;; Make the Agenda a dedicated side-window + (side . left) ;; to the left so it always stays open. + (inhibit-same-window . nil))) + +(add-to-list 'display-buffer-alist + '(rul/display-buffer-org-agenda-managed-p + (display-buffer-reuse-mode-window ;; Prioritize reuse of current window + display-buffer-in-tab) ;; over switching to the Org tab. + (tab-name . "Org"))) + +; tab-bar configuration +(global-set-key (kbd "C-") 'tab-bar-switch-to-next-tab) +(global-set-key (kbd "C-") 'tab-bar-switch-to-prev-tab) + +;(setq switch-to-buffer-obey-display-actions nil) + +(setq tab-bar-format + '(tab-bar-format-tabs + tab-bar-format-align-right + tab-bar-format-global + )) + +(setq tab-bar-new-tab-to 'rightmost) +(setq tab-bar-close-button-show nil) +(set-face-attribute 'tab-bar nil :height 0.8) +(tab-bar-mode 1) +(provide 'rul-wm) -- cgit v1.2.3