aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d/rul-lisp/packages/rul-wm.el
blob: 7b44163c728ec53d9e83328ef9d0c12b7861f5a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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-<next>") 'tab-bar-switch-to-next-tab)
(global-set-key (kbd "C-<prior>") '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)
nihil fit ex nihilo