From 1a020e1cf7d13a5409497c96753da32e1a307b00 Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 20 May 2022 23:59:19 +0100 Subject: exwm: app runners clean-ups --- exwm.org | 67 +++++++++++++++++++++++++--------------------------------------- 1 file changed, 26 insertions(+), 41 deletions(-) (limited to 'exwm.org') diff --git a/exwm.org b/exwm.org index b74fce8..917f8ba 100644 --- a/exwm.org +++ b/exwm.org @@ -207,7 +207,7 @@ (when (car bfs) (switch-to-buffer (car (reverse bfs)))))) #+end_src -* App runners +* App runner helpers #+begin_src emacs-lisp (defun jao-exwm-run (command) (interactive @@ -231,7 +231,7 @@ (interactive) ,@(when ws `((jao-exwm-workspace ,ws))) (if (jao-exwm-switch-to-class/title ,class) - ,(or (stringp (car args)) args) + ,(if (stringp (car args)) (cdr args) args) (setq jao-exwm--current-name ,class) ,(if (stringp (car args)) `(start-process-shell-command ,(car args) @@ -241,21 +241,14 @@ " ")) args)))) - (jao-def-exwm-runner jao-exwm-spotify 0 "Spotify" "spotify") - (jao-def-exwm-runner jao-exwm-spt 0 "spt" "xterm" "-e" "spt") - (jao-def-exwm-runner jao-exwm-firefox 5 "Firefox" "firefox") - - (defun jao-exwm-firefox-1 () - (interactive) - (jao-exwm-firefox) - (delete-other-windows)) - - (defun jao-exwm-browse-with-firefox (&rest args) - (jao-exwm-firefox-1) - (apply #'browse-url-firefox args)) - (setq browse-url-secondary-browser-function #'jao-exwm-browse-with-firefox) + (defun jao-exwm--send-str (str) + (dolist (k (string-to-list (kbd str))) + (exwm-input--fake-key k))) + #+end_src +* Runners + #+begin_src emacs-lisp (jao-def-exwm-runner jao-exwm-vlc 4 "VLC" "vlc") (jao-def-exwm-runner jao-exwm-slack 0 "Slack" "slack") @@ -285,6 +278,10 @@ (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) + (defalias 'jao-streaming-list #'jao-exwm-tidal) + (defun jao-exwm-import-screen (&optional area) (interactive "P") (when (not (file-directory-p "/tmp/screenshot")) @@ -294,31 +291,6 @@ "/tmp/screenshot/$(date +'%g%m%d-%H%M%S').png"))) (start-process-shell-command "import" "* exwm - console *" c))) - (defun jao-exwm--send-str (str) - (dolist (k (string-to-list (kbd str))) - (exwm-input--fake-key k))) - - #+end_src -* Deezer support - #+begin_src emacs-lisp - (jao-def-exwm-runner jao-exwm-deezer-1 5 "Deezer" "deezer-desktop") - - (defun jao-exwm-deezer () - (interactive) - (jao-exwm-deezer-1) - (delete-other-windows)) - - (defalias 'jao-streaming-list #'jao-exwm-deezer) - - (defun jao-exwm--with-deezer (fun) - (jao-exwm-deezer) - (funcall fun)) - - (defun jao-exwm-deezer-like () - (interactive) - (jao-exwm-deezer) - (jao-exwm--send-str "L")) - #+end_src * Zathura support #+begin_src emacs-lisp @@ -439,8 +411,21 @@ (jao-transient-major-mode+ doc-view viewers)) #+end_src -* Firefox helpers +* 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)) + + (defun jao-exwm-browse-with-firefox (&rest args) + (jao-exwm-firefox-1) + (apply #'browse-url-firefox args)) + + (setq browse-url-secondary-browser-function #'jao-exwm-browse-with-firefox) + (defun jao-exwm-kill-firefox-url () (interactive) (when-let (b (jao-exwm-find-class-buffer "Firefox")) -- cgit v1.2.3