summaryrefslogtreecommitdiff
path: root/.config/emacs/modules/bd--window.el
blob: 443a52156f9d1c138686b5bc693116bc11384584 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
;;; -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:


(require 'transient)

(use-package autorevert
  :init
  (global-auto-revert-mode)
  :config
  (setopt global-auto-revert-non-file-buffers t
	  auto-revert-interval 30))

(setopt switch-to-buffer-obey-display-actions t
	switch-to-buffer-in-dedicated-window 'pop)
;; C-u C-h a ^display-buffer-[^-]
(add-to-list 'display-buffer-alist
	     '("^\\*Async Shell Command\\*.*$"
	       (display-buffer-no-window)))
(add-to-list 'display-buffer-alist
	     '((major-mode . Info-mode)
	       (display-buffer-in-side-window)
	       (side . right)
	       (slot . -1)
	       (width . 0.15)))

(defun bd/layout--do-with-haste (f)
  (let* ((args (transient-args 'bd/layout-dispatcher))
	 (haste (if (member "haste" args) 3 1)))
    (funcall f haste)))
(transient-define-prefix bd/layout-dispatcher ()
  ["Dispatcher > Layout\n"
   ["Infixes"
    ("s" "haste" "haste")]]
  [["Commands"
    ("-" "text decrease"
     (lambda () (interactive) (bd/layout--do-with-haste #'text-scale-decrease))
     :transient t)
    ("=" "text increase"
     (lambda () (interactive) (bd/layout--do-with-haste #'text-scale-increase))
     :transient t)
    ("b" "narrow"
     (lambda () (interactive) (bd/layout--do-with-haste #'shrink-window-horizontally))
     :transient t)
    ("f" "widen"
     (lambda () (interactive) (bd/layout--do-with-haste #'enlarge-window-horizontally))
     :transient t)
    ("p" "shrink"
     (lambda () (interactive) (bd/layout--do-with-haste #'shrink-window))
     :transient t)
    ("n" "enlarge"
     (lambda () (interactive) (bd/layout--do-with-haste #'enlarge-window))
     :transient t)
    ("|" "balance" balance-windows)]
   [""
    ("N" "shift down" windmove-swap-states-down :transient t)
    ("P" "shift up" windmove-swap-states-up :transient t)
    ("F" "shift right" windmove-swap-states-right :transient t)
    ("B" "shift left" windmove-swap-states-left :transient t)]
   [""
    ("a" "alpha" bd/set-frame-alpha)
    ("w" "wallpaper" bd/set-bg)
    ("t" "theme" modus-themes-select)]])
(keymap-global-set "C-c w" #'bd/layout-dispatcher)


(provide 'bd--window)
;;; bd--window.el ends here