jao-custom-exwm.el 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. ;; -*- lexical-binding: t; -*-
  2. (require 'jao-pdf)
  3. ;;; Load and basic config
  4. (defvar jao-exwm--use-afio t)
  5. ;; (jao-load-path "exwm")
  6. (use-package exwm
  7. :ensure t
  8. :demand t
  9. :init (setq exwm-debug nil
  10. exwm-workspace-number 1
  11. exwm-workspace-show-all-buffers t
  12. exwm-workspace-warp-cursor nil
  13. exwm-layout-show-all-buffers t
  14. exwm-floating-border-color
  15. (if (jao-colors-scheme-dark-p) "black" "grey90")
  16. ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58245 :
  17. x-no-window-manager t))
  18. (use-package exwm-edit :ensure t)
  19. ;;; Frame(s) as workspaces
  20. (defun jao-exwm--new-frame-p ()
  21. (not (frame-parameter nil 'jao-frames-initialized)))
  22. (defun jao-exwm--mark-frame (force)
  23. (prog1 (or force (jao-exwm--new-frame-p))
  24. (set-frame-parameter nil 'jao-frames-initialized t)))
  25. (defun jao-exwm--goto-main (&optional init)
  26. (interactive "P")
  27. (exwm-workspace-switch-create 1)
  28. (when (jao-exwm--mark-frame init) (jao-trisect)))
  29. (defun jao-exwm--goto-mail (&optional init)
  30. (interactive "P")
  31. (exwm-workspace-switch-create 2)
  32. (when (jao-exwm--mark-frame init)
  33. (jao-afio-open-gnus)))
  34. (defun jao-exwm--goto-www (&optional init)
  35. (interactive "P")
  36. (exwm-workspace-switch-create 5)
  37. (when (jao-exwm--mark-frame init)
  38. (jao-afio-open-www)
  39. (let ((scroll-bar-mode 'left))
  40. (toggle-scroll-bar 1)
  41. (set-frame-parameter (window-frame) 'scroll-bar-width 12))
  42. (jao-toggle-inactive-mode-line)))
  43. (defun jao-exwm--goto-docs (&optional init)
  44. (interactive "P")
  45. (exwm-workspace-switch-create 4)
  46. (when (jao-exwm--mark-frame init)
  47. (jao-afio-open-doc)))
  48. (defun jao-exwm-open-doc (file)
  49. (jao-exwm--goto-docs)
  50. (jao-find-or-open file))
  51. (defun jao-exwm-no-afio-setup ()
  52. (interactive)
  53. (defalias 'jao-open-gnus-frame 'jao-exwm--goto-mail)
  54. (defalias 'jao-goto-www-frame 'jao-exwm--goto-www)
  55. (setq jao-open-doc-fun #'jao-exwm-open-doc)
  56. (setq minibuffer-follows-selected-frame t)
  57. (global-set-key "\C-cf" 'jao-exwm--goto-main)
  58. (global-set-key "\C-cg" 'jao-exwm--goto-mail)
  59. (global-set-key "\C-cw" 'jao-exwm--goto-www)
  60. (global-set-key "\C-cz" 'jao-exwm--goto-docs))
  61. (if jao-exwm--use-afio
  62. (setq minibuffer-follows-selected-frame nil)
  63. (jao-exwm-no-afio-setup))
  64. ;; tracking
  65. (add-hook 'exwm-workspace-switch-hook 'tracking-remove-visible-buffers)
  66. ;;; Buffer names
  67. (defun jao-exwm--use-title-p ()
  68. (and exwm-title (not (string-blank-p exwm-title))))
  69. (defun jao-exwm-rename-buffer/class ()
  70. (unless (jao-exwm--use-title-p)
  71. (exwm-workspace-rename-buffer exwm-class-name)))
  72. (defun jao-exwm-rename-buffer/title ()
  73. (cond ((or (not exwm-instance-name)
  74. (jao-exwm--use-title-p))
  75. (exwm-workspace-rename-buffer exwm-title))
  76. ((string= "Zathura" exwm-class-name)
  77. (exwm-workspace-rename-buffer
  78. (format "zathura: %s" (file-name-nondirectory exwm-title))))))
  79. (defun jao-exwm--set-exwm-name ()
  80. (when (not jao-exwm--name)
  81. (setq jao-exwm--name jao-exwm--current-name
  82. jao-exwm--current-name nil)))
  83. (add-hook 'exwm-mode-hook 'jao-exwm--set-exwm-name)
  84. (add-hook 'exwm-update-class-hook 'jao-exwm-rename-buffer/class)
  85. (add-hook 'exwm-update-title-hook 'jao-minibuffer-refresh)
  86. (add-hook 'exwm-update-title-hook 'jao-exwm-rename-buffer/title)
  87. ;;; Float windows
  88. (defvar jao-exwm-max-x (x-display-pixel-width))
  89. (defvar jao-exwm-max-y (x-display-pixel-height))
  90. (defun jao-exwm--float-to (x y &optional w h)
  91. (let* ((w (or w (frame-pixel-width)))
  92. (h (or h (frame-pixel-height)))
  93. (x (if (< x 0) (- jao-exwm-max-x (- x) w) x))
  94. (y (if (< y 0) (- jao-exwm-max-y (- y) h) y))
  95. (p (or (frame-parameter nil 'jao-position) (frame-position))))
  96. (exwm-floating-move (- x (car p)) (- y (cdr p)))
  97. (exwm-layout-enlarge-window-horizontally (- w (frame-pixel-width)))
  98. (exwm-layout-enlarge-window (- h (frame-pixel-height)))
  99. (set-frame-parameter nil 'jao-position (cons x y))))
  100. (defun jao-exwm--center-float (&optional w h)
  101. (interactive)
  102. (let* ((mx jao-exwm-max-x)
  103. (my jao-exwm-max-y)
  104. (w (or w (frame-pixel-width)))
  105. (h (or h (/ (* w my) mx))))
  106. (jao-exwm--float-to (/ (- mx w) 2) (/ (- my h) 2) w h)))
  107. (defun jao-exwm--setup-float ()
  108. (set-frame-parameter nil 'jao-position nil)
  109. (cond ((member exwm-class-name '("firefox" "Firefox" "Sofice"))
  110. (jao-exwm--center-float 900 600))
  111. ((member exwm-class-name '("mpv" "vlc"))
  112. (jao-exwm--center-float 1200))))
  113. (defvar jao-exwm-floating-classes '("mpv" "vlc"))
  114. (setq jao-exwm-floating-classes nil)
  115. (defun jao-exwm--maybe-float ()
  116. (when (member exwm-class-name jao-exwm-floating-classes)
  117. (when (not exwm--floating-frame)
  118. (exwm-floating-toggle-floating))))
  119. (add-hook 'exwm-floating-setup-hook #'jao-exwm--setup-float)
  120. (add-hook 'exwm-manage-finish-hook #'jao-exwm--maybe-float)
  121. ;; Minibuffer and system tray
  122. (setq jao-minibuffer-frame-width 271)
  123. (add-hook 'exwm-workspace-switch-hook #'jao-minibuffer-refresh)
  124. (require 'exwm-systemtray)
  125. (exwm-systemtray-mode 1)
  126. (defun jao-exwm--watch-tray (sym newval op where)
  127. (setq jao-minibuffer-right-margin (* 2 (length newval)))
  128. (jao-minibuffer-refresh))
  129. (add-variable-watcher 'exwm-systemtray--list #'jao-exwm--watch-tray)
  130. ;; Switch to buffer / app
  131. (defvar-local jao-exwm--name nil)
  132. (defvar jao-exwm--current-name nil)
  133. (defun jao-exwm--check-name (name)
  134. (or (string= jao-exwm--name name)
  135. (string= (buffer-name) name)
  136. (string= exwm-class-name name)
  137. (string= exwm-title name)))
  138. (defun jao-exwm-find-class-buffer (cln)
  139. (if (jao-exwm--check-name cln)
  140. (current-buffer)
  141. (let* ((cur-buff (current-buffer))
  142. (bfs (seq-filter (lambda (b)
  143. (and (not (eq b cur-buff))
  144. (with-current-buffer b
  145. (jao-exwm--check-name cln))))
  146. (buffer-list))))
  147. (when (car bfs) (car (reverse bfs))))))
  148. (defun jao-exwm-switch-to-class/title (cln)
  149. (interactive)
  150. (when cln
  151. (if (jao-exwm--check-name cln)
  152. (current-buffer)
  153. (when-let ((b (jao-exwm-find-class-buffer cln)))
  154. (pop-to-buffer b)))))
  155. (defun jao-exwm-switch-to-next-class ()
  156. (interactive)
  157. (jao-exwm-switch-to-class/title exwm-class-name))
  158. (defun jao-exwm-switch-to-next-x ()
  159. (interactive)
  160. (let ((bfs (seq-filter (lambda (b) (buffer-local-value 'exwm-class-name b))
  161. (buffer-list (window-frame)))))
  162. (when (car bfs) (switch-to-buffer (car (reverse bfs))))))
  163. ;;; App runner helpers
  164. (defun jao-exwm-run (command)
  165. (interactive
  166. (list (read-shell-command "$ "
  167. (if current-prefix-arg
  168. (cons (concat " " (buffer-file-name)) 0)
  169. ""))))
  170. (setq jao-exwm--current-name nil)
  171. (start-process-shell-command command nil command))
  172. (defmacro jao-exwm-runner (&rest args)
  173. `(lambda () (interactive) (start-process "" nil ,@args)))
  174. (defun jao-exwm-workspace (n)
  175. (if jao-exwm--use-afio
  176. (jao-afio-goto-nth n)
  177. (exwm-workspace-switch-create n)))
  178. (defmacro jao-def-exwm-runner (name ws class &rest args)
  179. `(defun ,name (&rest other-args)
  180. (interactive)
  181. ,@(when ws `((jao-exwm-workspace ,ws)))
  182. (if (jao-exwm-switch-to-class/title ,class)
  183. ,(cond ((equal ws -1) '(delete-other-windows))
  184. ((stringp (car args)) (cdr args))
  185. (t args))
  186. (setq jao-exwm--current-name ,class)
  187. ,(if (stringp (car args))
  188. `(start-process-shell-command ,(car args)
  189. "* exwm - console *"
  190. (string-join (append (list ,@args)
  191. other-args)
  192. " "))
  193. args))))
  194. (defmacro jao-def-exwm-toggler (name ws class &rest args)
  195. (let ((toggler (intern (format "%s*" name)))
  196. (arg (gensym)))
  197. `(progn (jao-def-exwm-runner ,name ,ws ,class ,@args)
  198. (defun ,toggler (,arg)
  199. (interactive "P")
  200. (if (and (not ,arg) (equal exwm-class-name ,class))
  201. (jao-afio-toggle)
  202. (,name))))))
  203. (defun jao-exwm--send-str (str)
  204. (dolist (k (string-to-list (kbd str)))
  205. (exwm-input--fake-key k)))
  206. ;;; Runners
  207. (jao-def-exwm-runner jao-exwm-vlc 4 "VLC" "vlc")
  208. (jao-def-exwm-runner jao-exwm-slack 0 "Slack" "slack")
  209. (jao-def-exwm-runner jao-exwm-signal 0 "Signal" "signal-desktop")
  210. (jao-def-exwm-runner jao-exwm-proton-bridge 0 "*proton-bridge*" "protonmail-bridge")
  211. ;; (jao-def-exwm-runner jao-exwm-htop 0 "htop-xterm"
  212. ;; "xterm" "-title" "htop-xterm" "-e" "htop")
  213. (jao-def-exwm-runner jao-exwm-htop 0 "htop" jao-term-htop)
  214. ;; (jao-def-exwm-runner jao-exwm-aptitude 0 "aptitude-xterm"
  215. ;; "xterm" "-title" "aptitude-xterm" "-e" "aptitude")
  216. (jao-def-exwm-runner jao-exwm-aptitude 0 "aptitude" jao-term-aptitude)
  217. (jao-def-exwm-runner jao-exwm-blueman 0 "Blueman-manager" "blueman-manager")
  218. (jao-def-exwm-runner jao-exwm-ncmpcpp 0 "ncmpcpp" "xterm" "-e" "ncmpcpp" "-p" "6669")
  219. (jao-def-exwm-runner jao-exwm-mpc 0 "*MPC-Status*" mpc)
  220. (jao-def-exwm-runner jao-exwm-proton-vpn 0 "*pvpn*" proton-vpn-status)
  221. (jao-def-exwm-runner jao-exwm-enwc 0 "*ENWC*" enwc)
  222. (jao-def-exwm-runner jao-exwm-bluetooth 0 "*Bluetooth*" bluetooth-list-devices)
  223. (jao-def-exwm-runner jao-exwm-packages 0 "*Packages*" list-packages nil)
  224. (jao-def-exwm-runner jao-exwm-proced 0 "*Proced*" proced)
  225. (jao-def-exwm-runner jao-exwm-open-with-zathura nil nil "zathura" (buffer-file-name))
  226. (jao-def-exwm-runner jao-exwm-open-with-mupdf nil nil "mupdf" (buffer-file-name))
  227. (jao-def-exwm-runner jao-exwm-xterm 0 nil "xterm")
  228. ;; (jao-def-exwm-toggler jao-exwm-tidal -1 "tidal-hifi" "tidal-hifi")
  229. ;; (jao-def-exwm-toggler jao-exwm-spt -1 "spt" "kitty" "-e" "spt")
  230. ;; (defalias 'jao-streaming-list #'jao-exwm-spt*)
  231. (defun jao-exwm-import-screen (&optional area)
  232. (interactive "P")
  233. (when (not (file-directory-p "/tmp/screenshot"))
  234. (make-directory "/tmp/screenshot"))
  235. (let ((c (format "import %s %s"
  236. (if area "" "-window root")
  237. "/tmp/screenshot/$(date +'%g%m%d-%H%M%S').png")))
  238. (start-process-shell-command "import" "* exwm - console *" c)))
  239. ;;; Zathura support
  240. (defun jao-zathura--buffer-p (b)
  241. (string= "Zathura" (or (buffer-local-value 'exwm-class-name b) "")))
  242. (defun jao-zathura--buffers ()
  243. (seq-filter #'jao-zathura--buffer-p (buffer-list)))
  244. (defun jao-zathura--file-info (b)
  245. (with-current-buffer b
  246. (jao-pdf-zathura-file-info (or exwm-title ""))))
  247. (defun jao-zathura-goto-page (page-no)
  248. (jao-exwm--send-str (format "%sg" page-no)))
  249. (defun jao-zathura-open-doc (&optional file-name page-no height)
  250. (interactive)
  251. (let* ((file-name (expand-file-name (or file-name (buffer-file-name))))
  252. (buffer (seq-find `(lambda (b)
  253. (string= ,file-name
  254. (car (jao-zathura--file-info b))))
  255. (jao-zathura--buffers)))
  256. (page-no (or page-no (jao-doc-view-current-page))))
  257. (if jao-exwm--use-afio (jao-afio-goto-docs) (jao-exwm--goto-docs))
  258. (if (not buffer)
  259. (jao-exwm-run (if page-no
  260. (format "zathura -P %s '%s'" page-no file-name)
  261. (format "zathura '%s'" file-name)))
  262. (pop-to-buffer buffer)
  263. (when page-no (jao-zathura-goto-page page-no)))
  264. (current-buffer)))
  265. (defun jao-exwm--zathura-setup ()
  266. (when (and (string= exwm-class-name "Zathura")
  267. (not jao-pdf--outline))
  268. (let ((info (jao-zathura--file-info (current-buffer))))
  269. (jao-doc-session-mark (car info))
  270. (jao-doc-session-save)
  271. (doc-view-imenu-index (car info) #'jao-zathura-goto-page))))
  272. (add-hook 'exwm-update-title-hook #'jao-exwm--zathura-setup t)
  273. (defun jao-exwm-pdf-zathura-close-all ()
  274. (interactive)
  275. (dolist (b (jao-zathura--buffers))
  276. (ignore-errors
  277. (switch-to-buffer b)
  278. (jao-exwm--send-str "q")))
  279. t)
  280. (defun jao-exwm-zathura-goto-org (&optional arg)
  281. (interactive "P")
  282. (when-let ((info (jao-zathura--file-info (current-buffer))))
  283. (when-let ((file (jao-org-find-for-pdf (car info))))
  284. (let ((newp (not (file-exists-p file))))
  285. (when (or arg newp) (org-store-link nil t))
  286. (find-file-other-window file)
  287. (when newp
  288. (jao-org-insert-doc-skeleton)
  289. (org-insert-link))))))
  290. (defun jao-exwm-zathura-goto-org* ()
  291. (interactive)
  292. (jao-exwm-zathura-goto-org t))
  293. (defun jao-exwm-org-store-zathura-link ()
  294. (when-let ((info (jao-zathura--file-info (current-buffer))))
  295. (let* ((file-name (car info))
  296. (page (cadr info))
  297. (desc (jao-pdf-section-title page file-name)))
  298. (jao-org-links-store-pdf-link file-name page desc))))
  299. (defun jao-exwm-pdf-enable-zathura ()
  300. (interactive)
  301. (add-hook 'kill-emacs-query-functions #'jao-exwm-pdf-zathura-close-all t)
  302. (setq jao-browse-doc-use-emacs-p nil)
  303. (setq jao-org-open-pdf-fun #'jao-zathura-open-doc)
  304. (setq jao-org-links-pdf-store-fun #'jao-exwm-org-store-zathura-link)
  305. (setq jao-open-doc-fun #'jao-zathura-open-doc))
  306. (defun jao-exwm-pdf-disable-zathura ()
  307. (interactive)
  308. (remove-hook 'kill-emacs-query-functions #'jao-exwm-pdf-zathura-close-all)
  309. (setq jao-browse-doc-use-emacs-p t)
  310. (setq jao-org-open-pdf-fun #'jao-find-or-open)
  311. (setq jao-org-links-pdf-store-fun nil)
  312. (setq jao-open-doc-fun #'jao-find-or-open))
  313. (defun jao-exwm-org-to-pdf-file ()
  314. (expand-file-name (concat "doc/" (file-name-base buffer-file-name) ".pdf")
  315. (file-name-directory jao-org-notes-dir)))
  316. (defun jao-exwm-zathura-goto-pdf ()
  317. (interactive)
  318. (if jao-browse-doc-use-emacs-p
  319. (jao-org-goto-pdf)
  320. (when-let (pdf (jao-exwm-org-to-pdf-file))
  321. (jao-zathura-open-doc pdf))))
  322. (with-eval-after-load "org"
  323. (define-key org-mode-map (kbd "C-c o") #'jao-exwm-zathura-goto-pdf))
  324. (when (not jao-browse-doc-use-emacs-p)
  325. (jao-exwm-pdf-enable-zathura))
  326. (defun jao-exwm-select-pdf ()
  327. (interactive)
  328. (let ((b (read-buffer "Document: " nil t
  329. (lambda (b)
  330. (let ((b (cdr b)))
  331. (or (jao-zathura--buffer-p b)
  332. (member (buffer-local-value 'major-mode b)
  333. '(pdf-view-mode doc-view-mode))))))))
  334. (jao-afio-goto-docs)
  335. (pop-to-buffer b)))
  336. (jao-transient-major-mode+ doc-view
  337. ["External viewers"
  338. ("z" "open with zathura" jao-zathura-open-doc)
  339. ("m" "open with mupdf" jao-exwm-open-with-mupdf)])
  340. ;;; Firefox support
  341. (jao-def-exwm-toggler jao-exwm-firefox -1 "firefox" "firefox")
  342. (defun jao-exwm-browse-with-firefox (&rest args)
  343. (jao-exwm-firefox)
  344. (apply #'browse-url-firefox args))
  345. (setq browse-url-secondary-browser-function #'jao-exwm-browse-with-firefox)
  346. (defun jao-exwm-kill-firefox-url ()
  347. (interactive)
  348. (when-let (b (jao-exwm-find-class-buffer "Firefox"))
  349. (let ((cb (current-buffer)))
  350. (switch-to-buffer b)
  351. (jao-exwm--send-str "yy")
  352. (prog1 (current-kill 1)
  353. (switch-to-buffer cb)))))
  354. ;;; Transients
  355. (defun jao-exwm--floating-p () exwm--floating-frame)
  356. (defun jao-exwm--m0-5 () (interactive nil exwm-mode) (exwm-floating-move 0 -5))
  357. (defun jao-exwm--m05 () (interactive nil exwm-mode) (exwm-floating-move 0 5))
  358. (defun jao-exwm--m-50 () (interactive nil exwm-mode) (exwm-floating-move -5 0))
  359. (defun jao-exwm--m50 () (interactive nil exwm-mode) (exwm-floating-move 5 0))
  360. (defun jao-exwm--e-5 () (interactive nil exwm-mode) (exwm-layout-enlarge-window -5))
  361. (defun jao-exwm--e5 () (interactive nil exwm-mode) (exwm-layout-enlarge-window 5))
  362. (defun jao-exwm--eh5 () (interactive nil exwm-mode) (exwm-layout-enlarge-window 5 t))
  363. (defun jao-exwm--eh-5 () (interactive nil exwm-mode) (exwm-layout-enlarge-window -5 t))
  364. (defun jao-exwm--tl () (interactive nil exwm-mode) (jao-exwm--float-to 20 20))
  365. (defun jao-exwm--tr () (interactive nil exwm-mode) (jao-exwm--float-to -20 20))
  366. (defun jao-exwm--bl () (interactive nil exwm-mode) (jao-exwm--float-to 20 -20))
  367. (defun jao-exwm--br () (interactive nil exwm-mode) (jao-exwm--float-to -20 -20))
  368. (defun jao-exwm--def-center-float ()
  369. (interactive)
  370. (exwm-floating-toggle-floating)
  371. (jao-exwm--center-float 900 600))
  372. (transient-define-prefix jao-transient-float ()
  373. "Operations on EXWM floating windows."
  374. :transient-non-suffix 'transient--do-quit-one
  375. [["Float"
  376. ("f" "float" exwm-floating-toggle-floating)
  377. ("F" "full" exwm-layout-toggle-fullscreen)
  378. ("c" "center" jao-exwm--center-float :if jao-exwm--floating-p)
  379. ("c" "float and resize" jao-exwm--def-center-float
  380. :if-not jao-exwm--floating-p)
  381. ("x" "hide" exwm-floating-hide :if jao-exwm--floating-p)]
  382. ["Slide" :if jao-exwm--floating-p
  383. ("k" "up" jao-exwm--m0-5 :transient t)
  384. ("j" "down" jao-exwm--m05 :transient t)
  385. ("h" "left" jao-exwm--m-50 :transient t)
  386. ("l" "right" jao-exwm--m50 :transient t)]
  387. ["Resize" :if jao-exwm--floating-p
  388. ("K" "up" jao-exwm--e5 :transient t)
  389. ("J" "down" jao-exwm--e-5 :transient t)
  390. ("H" "left" jao-exwm--eh5 :transient t)
  391. ("L" "right" jao-exwm--eh-5 :transient t)]
  392. ["Nudge" :if jao-exwm--floating-p
  393. ("t" "top-left" jao-exwm--tl)
  394. ("T" "top-right" jao-exwm--tr)
  395. ("b" "bottom-left" jao-exwm--bl)
  396. ("B" "bottom-right " jao-exwm--br)]])
  397. (defun jao-exwm--buffer ()
  398. (interactive)
  399. (jao-buffer-same-mode 'exwm-mode nil 'exwm-workspace-switch-to-buffer))
  400. ;;; Keybindings
  401. (define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key)
  402. (define-key exwm-mode-map [?\s-f] #'jao-transient-float)
  403. (define-key exwm-mode-map (kbd "C-c o") #'jao-exwm-zathura-goto-org)
  404. (define-key exwm-mode-map (kbd "C-c O") #'jao-exwm-zathura-goto-org*)
  405. (define-key exwm-mode-map (kbd "M-o") #'jao-afio-toggle)
  406. (define-key exwm-mode-map (kbd "M-p") #'jao-prev-window)
  407. (setq
  408. exwm-input-global-keys
  409. '(([?\s-0] . jao-afio-goto-scratch)
  410. ([?\s-1] . jao-afio-goto-main)
  411. ([?\s-2] . jao-afio-goto-mail)
  412. ([?\s-3] . jao-afio-goto-www)
  413. ([?\s-4] . jao-afio-goto-docs)
  414. ([?\s-5] . jao-afio-goto-chats)
  415. ([?\s-A] . jao-org-agenda)
  416. ([?\s-a] . jao-first-window)
  417. ([?\s-b] . jao-transient-org-blog)
  418. ([?\s-d] . jao-exwm-tidal*)
  419. ([?\s-e] . jao-exwm-firefox*)
  420. ([?\s-m] . jao-transient-media)
  421. ;; ([?\s-O] . switch-window-then-swap-buffer)
  422. ([?\s-o] . jao-afio-toggle)
  423. ([?\s-p] . jao-prev-window)
  424. ([?\s-R] . app-launcher-run-app)
  425. ([?\s-r] . jao-transient-recoll)
  426. ([?\s-s] . jao-transient-streaming)
  427. ([?\s-n] . jao-transient-ednc)
  428. ([?\s-t] . eat)
  429. ([?\s-w] . jao-transient-utils)
  430. ([?\s-z] . jao-transient-sleep)
  431. ([XF86AudioMute] . jao-mixer-master-toggle)
  432. ([XF86AudioPlay] . jao-player-toggle)
  433. ([XF86AudioPause] . jao-player-toggle)
  434. ([XF86AudioNext] . jao-player-next)
  435. ([XF86AudioPrev] . jao-player-previous)
  436. ([XF86AudioStop] . jao-player-stop)
  437. ([XF86AudioRaiseVolume] . jao-mixer-master-up)
  438. ([XF86AudioLowerVolume] . jao-mixer-master-down)
  439. ([XF86MonBrightnessUp] . jao-bright-up)
  440. ([XF86MonBrightnessDown] . jao-bright-down)
  441. ([?\s-\`] . jao-exwm-switch-to-next-x)
  442. ([s-tab] . jao-exwm-switch-to-next-class)
  443. ([print] . jao-exwm-import-screen)
  444. ([f5] . jao-weather)
  445. ([f6] . jao-toggle-audio-applet)
  446. ([f8] . jao-toggle-nm-applet)
  447. ([f9] . jao-bright-show)))
  448. ;; (customize-set-variable 'exwm-input-global-keys exwm-input-global-keys)
  449. ;;; .
  450. (provide 'jao-custom-exwm)