blob: d36c8f175435f5fed7cb1fcbfe629a95c1cc73fe (
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
;; -*- lexical-binding: t; -*-
;;; Load and basic config
(use-package exwm
:ensure t
:demand t
:init (setq exwm-debug nil
exwm-workspace-number 1
exwm-workspace-show-all-buffers t
exwm-workspace-warp-cursor nil
exwm-layout-show-all-buffers t
exwm-floating-border-color
(if (jao-colors-scheme-dark-p) "black" "grey90")
;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58245 :
x-no-window-manager t)
:config
(use-package jao-exwm
:demand t)
(use-package exwm-edit :ensure t))
;;; Runners
;; (jao-def-exwm-runner jao-exwm-vlc 4 "VLC" "vlc")
;; (jao-def-exwm-runner jao-exwm-slack 0 "Slack" "slack")
;; (jao-def-exwm-runner jao-exwm-signal 0 "Signal" "signal-desktop")
;; (jao-def-exwm-runner jao-exwm-proton-bridge 0 "*proton-bridge*" "protonmail-bridge")
;; (jao-def-exwm-runner jao-exwm-htop 0 "htop-xterm"
;; "xterm" "-title" "htop-xterm" "-e" "htop")
(jao-def-exwm-runner jao-exwm-htop 0 "htop" jao-term-htop)
(jao-def-exwm-runner jao-exwm-aptitude 0 "aptitude-xterm"
"xterm" "-title" "aptitude-xterm" "-e" "aptitude")
;; (jao-def-exwm-runner jao-exwm-aptitude 0 "aptitude" jao-term-aptitude)
(jao-def-exwm-runner jao-exwm-blueman 0 "Blueman-manager" "blueman-manager")
(jao-def-exwm-runner jao-exwm-ncmpcpp 0 "ncmpcpp" "xterm" "-e" "ncmpcpp" "-p" "6669")
(jao-def-exwm-runner jao-exwm-mpc 0 "*MPC-Status*" mpc)
(jao-def-exwm-runner jao-exwm-proton-vpn 0 "*pvpn*" proton-vpn-status)
(jao-def-exwm-runner jao-exwm-enwc 0 "*ENWC*" enwc)
(jao-def-exwm-runner jao-exwm-bluetooth 0 "*Bluetooth*" bluetooth-list-devices)
(jao-def-exwm-runner jao-exwm-packages 0 "*Packages*" list-packages nil)
(jao-def-exwm-runner jao-exwm-proced 0 "*Proced*" proced)
(jao-def-exwm-runner jao-exwm-open-with-zathura nil nil "zathura" (buffer-file-name))
(jao-def-exwm-runner jao-exwm-open-with-mupdf nil nil "mupdf" (buffer-file-name))
(jao-def-exwm-runner jao-exwm-xterm 0 nil "xterm")
;;; Screenshot
(defun jao-exwm-import-screen (&optional area)
(interactive "P")
(when (not (file-directory-p "/tmp/screenshot"))
(make-directory "/tmp/screenshot"))
(let ((c (format "import %s %s"
(if area "" "-window root")
"/tmp/screenshot/$(date +'%g%m%d-%H%M%S').png")))
(start-process-shell-command "import" "* exwm - console *" c)))
;;; Firefox support
(setq browse-url-secondary-browser-function #'jao-exwm-browse-with-firefox)
;;; Transients
(jao-transient-major-mode+ doc-view
["External viewers"
("z" "open with zathura" jao-zathura-open-doc)
("m" "open with mupdf" jao-exwm-open-with-mupdf)])
(defun jao-exwm--floating-p () exwm--floating-frame)
(defun jao-exwm--m0-5 () (interactive nil exwm-mode) (exwm-floating-move 0 -5))
(defun jao-exwm--m05 () (interactive nil exwm-mode) (exwm-floating-move 0 5))
(defun jao-exwm--m-50 () (interactive nil exwm-mode) (exwm-floating-move -5 0))
(defun jao-exwm--m50 () (interactive nil exwm-mode) (exwm-floating-move 5 0))
(defun jao-exwm--e-5 () (interactive nil exwm-mode) (exwm-layout-enlarge-window -5))
(defun jao-exwm--e5 () (interactive nil exwm-mode) (exwm-layout-enlarge-window 5))
(defun jao-exwm--eh5 () (interactive nil exwm-mode) (exwm-layout-enlarge-window 5 t))
(defun jao-exwm--eh-5 () (interactive nil exwm-mode) (exwm-layout-enlarge-window -5 t))
(defun jao-exwm--tl () (interactive nil exwm-mode) (jao-exwm--float-to 20 20))
(defun jao-exwm--tr () (interactive nil exwm-mode) (jao-exwm--float-to -20 20))
(defun jao-exwm--bl () (interactive nil exwm-mode) (jao-exwm--float-to 20 -20))
(defun jao-exwm--br () (interactive nil exwm-mode) (jao-exwm--float-to -20 -20))
(defun jao-exwm--def-center-float ()
(interactive)
(exwm-floating-toggle-floating)
(jao-exwm--center-float 900 600))
(transient-define-prefix jao-transient-float ()
"Operations on EXWM floating windows."
:transient-non-suffix 'transient--do-quit-one
[["Float"
("f" "float" exwm-floating-toggle-floating)
("F" "full" exwm-layout-toggle-fullscreen)
("c" "center" jao-exwm--center-float :if jao-exwm--floating-p)
("c" "float and resize" jao-exwm--def-center-float
:if-not jao-exwm--floating-p)
("x" "hide" exwm-floating-hide :if jao-exwm--floating-p)]
["Slide" :if jao-exwm--floating-p
("k" "up" jao-exwm--m0-5 :transient t)
("j" "down" jao-exwm--m05 :transient t)
("h" "left" jao-exwm--m-50 :transient t)
("l" "right" jao-exwm--m50 :transient t)]
["Resize" :if jao-exwm--floating-p
("K" "up" jao-exwm--e5 :transient t)
("J" "down" jao-exwm--e-5 :transient t)
("H" "left" jao-exwm--eh5 :transient t)
("L" "right" jao-exwm--eh-5 :transient t)]
["Nudge" :if jao-exwm--floating-p
("t" "top-left" jao-exwm--tl)
("T" "top-right" jao-exwm--tr)
("b" "bottom-left" jao-exwm--bl)
("B" "bottom-right " jao-exwm--br)]])
(defun jao-exwm--buffer ()
(interactive)
(jao-buffer-same-mode 'exwm-mode nil 'exwm-workspace-switch-to-buffer))
;;; Keybindings
(define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key)
(define-key exwm-mode-map [?\s-f] #'jao-transient-float)
(define-key exwm-mode-map (kbd "C-c o") #'jao-exwm-zathura-goto-org)
(define-key exwm-mode-map (kbd "C-c O") #'jao-exwm-zathura-goto-org*)
(define-key exwm-mode-map (kbd "M-o") #'jao-afio-toggle)
(define-key exwm-mode-map (kbd "M-p") #'jao-prev-window)
(setq
exwm-input-global-keys
'(([?\s-0] . jao-afio-goto-scratch)
([?\s-1] . jao-afio-goto-main)
([?\s-2] . jao-afio-goto-mail)
([?\s-3] . jao-afio-goto-www)
([?\s-4] . jao-afio-goto-docs)
([?\s-5] . jao-afio-goto-chats)
([?\s-A] . jao-afio-org-agenda)
([?\s-a] . jao-first-window)
([?\s-b] . jao-transient-org-blog)
([?\s-d] . jao-exwm-tidal*)
([?\s-e] . jao-exwm-firefox*)
([?\s-m] . jao-transient-media)
;; ([?\s-O] . switch-window-then-swap-buffer)
([?\s-o] . jao-afio-toggle)
([?\s-p] . jao-prev-window)
([?\s-R] . app-launcher-run-app)
([?\s-r] . jao-transient-recoll)
([?\s-s] . jao-transient-streaming)
([?\s-n] . jao-transient-ednc)
([?\s-t] . eat)
([?\s-w] . jao-transient-utils)
([?\s-z] . jao-transient-sleep)
([XF86AudioMute] . jao-mixer-master-toggle)
([XF86AudioPlay] . jao-player-toggle)
([XF86AudioPause] . jao-player-toggle)
([XF86AudioNext] . jao-player-next)
([XF86AudioPrev] . jao-player-previous)
([XF86AudioStop] . jao-player-stop)
([XF86AudioRaiseVolume] . jao-mixer-master-up)
([XF86AudioLowerVolume] . jao-mixer-master-down)
([XF86MonBrightnessUp] . jao-bright-up)
([XF86MonBrightnessDown] . jao-bright-down)
([?\s-\`] . jao-exwm-switch-to-next-x)
([s-tab] . jao-exwm-switch-to-next-class)
([print] . jao-exwm-import-screen)
([f6] . jao-toggle-audio-applet)
([f8] . jao-toggle-nm-applet)
([f9] . jao-bright-show)))
;; (customize-set-variable 'exwm-input-global-keys exwm-input-global-keys)
(exwm-wm-mode)
;;; .
(provide 'jao-custom-exwm)
|