aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d/rul-lisp/packages/rul-wm.el
blob: eac14e7ac129800cbb8ade7370854314f3cc690b (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
;;;; window.el
;; 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)))))

(setq display-buffer-alist
      '(;; Org Agenda in dedicated side-window
        ("\\*Org Agenda\\*"
         (display-buffer-in-tab
          display-buffer-reuse-mode-window)
         (ignore-current-tab . t)
         (tab-name . "Org")
         (dedicated . side)
         (side . left)
         (inhibit-same-window . nil))
        ;; Attempt window reuse for org-mode
        (rul/display-buffer-org-agenda-managed-p
          (display-buffer-reuse-mode-window
           display-buffer-in-tab)
          (tab-name . "Org"))
        (;; Notmuch in dedicated tab
         ".*notmuch.*"
         (display-buffer-in-tab
          display-buffer-reuse-mode-window)
         (ignore-current-tab . t)
         (tab-name . "Mail"))
        (;; Notmuch in dedicated tab
         ".*elfeed.*"
         (display-buffer-in-tab
          display-buffer-reuse-mode-window)
         (ignore-current-tab . t)
         (tab-name . "Elfeed"))
        ))


;;;; tab-bar.el
(let ((map global-map))
(define-key map (kbd "C-<next>") 'tab-bar-switch-to-next-tab)
(define-key map (kbd "C-<prior>") 'tab-bar-switch-to-prev-tab)
(define-key map (kbd "<f8>") 'tab-bar-mode))

(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