summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-05-21 03:36:36 +0100
committerjao <jao@gnu.org>2022-05-21 03:36:36 +0100
commit5f87eb37b6bd0fe273c24f6678a99ce1f846ed06 (patch)
treeb10e7cef0fbec04dd65d8fcbdd3403d809b89a37
parent1a020e1cf7d13a5409497c96753da32e1a307b00 (diff)
downloadelibs-5f87eb37b6bd0fe273c24f6678a99ce1f846ed06.tar.gz
elibs-5f87eb37b6bd0fe273c24f6678a99ce1f846ed06.tar.bz2
exwm: app togglers
-rw-r--r--exwm.org34
1 files changed, 17 insertions, 17 deletions
diff --git a/exwm.org b/exwm.org
index 917f8ba..41adb52 100644
--- a/exwm.org
+++ b/exwm.org
@@ -231,7 +231,9 @@
(interactive)
,@(when ws `((jao-exwm-workspace ,ws)))
(if (jao-exwm-switch-to-class/title ,class)
- ,(if (stringp (car args)) (cdr args) args)
+ ,(cond ((equal ws 5) '(delete-other-windows))
+ ((stringp (car args)) (cdr args))
+ (t args))
(setq jao-exwm--current-name ,class)
,(if (stringp (car args))
`(start-process-shell-command ,(car args)
@@ -241,6 +243,15 @@
" "))
args))))
+ (defmacro jao-def-exwm-toggler (name ws class &rest args)
+ (let ((toggler (intern (format "%s*" name)))
+ (arg (gensym)))
+ `(progn (jao-def-exwm-runner ,name ,ws ,class ,@args)
+ (defun ,toggler (,arg)
+ (interactive "P")
+ (if (and (not ,arg) (equal exwm-class-name ,class))
+ (jao-afio--goto-main)
+ (,name))))))
(defun jao-exwm--send-str (str)
(dolist (k (string-to-list (kbd str)))
@@ -278,8 +289,7 @@
(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")
- (jao-def-exwm-runner jao-exwm-tidal 5
- "tidal-hifi" "tidal-hifi" delete-other-windows)
+ (jao-def-exwm-toggler jao-exwm-tidal 5 "tidal-hifi" "tidal-hifi")
(defalias 'jao-streaming-list #'jao-exwm-tidal)
(defun jao-exwm-import-screen (&optional area)
@@ -413,15 +423,10 @@
#+end_src
* Firefox support
#+begin_src emacs-lisp
- (jao-def-exwm-runner jao-exwm-firefox 5 "Firefox" "firefox")
-
- (defun jao-exwm-firefox-1 ()
- (interactive)
- (jao-exwm-firefox)
- (delete-other-windows))
+ (jao-def-exwm-toggler jao-exwm-firefox 5 "Firefox" "firefox")
(defun jao-exwm-browse-with-firefox (&rest args)
- (jao-exwm-firefox-1)
+ (jao-exwm-firefox)
(apply #'browse-url-firefox args))
(setq browse-url-secondary-browser-function #'jao-exwm-browse-with-firefox)
@@ -434,12 +439,6 @@
(jao-exwm--send-str "yy")
(switch-to-buffer cb))))
- (defun jao-exwm-toggle-firefox (ff)
- (interactive "P")
- (if (and (not ff) (equal exwm-class-name "Firefox"))
- (jao-afio--goto-main)
- (jao-exwm-firefox-1)))
-
#+end_src
* Transients
#+begin_src emacs-lisp
@@ -512,7 +511,8 @@
([?\s-A] . org-agenda-list)
([?\s-a] . jao-first-window)
([?\s-b] . jao-transient-org-blog)
- ([?\s-e] . jao-exwm-toggle-firefox)
+ ([?\s-d] . jao-exwm-tidal*)
+ ([?\s-e] . jao-exwm-firefox*)
([?\s-m] . jao-transient-media)
;; ([?\s-O] . jao-transpose-windows)
;; ([?\s-o] . jao-other-window)