From 6e3513a1e72c3ecb2706129cccf1f32331c060b8 Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 23 Sep 2022 01:04:24 +0100 Subject: river tweaks --- lib/eos/jao-wayland.el | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/eos/jao-wayland.el b/lib/eos/jao-wayland.el index 8068dd7..104bd23 100644 --- a/lib/eos/jao-wayland.el +++ b/lib/eos/jao-wayland.el @@ -51,10 +51,10 @@ (defun jao-river-focus-window (title &optional rx) (let* ((ws (jao-river-window-list)) - (fltr (if rx #'string-match-p #'string=) ) + (fltr (if rx #'string-match-p #'string=)) (w (seq-find (lambda (w) - (or (funcall fltr title (alist-get 'title w "")) - (funcall fltr title (alist-get 'app_id w "")))) + (or (funcall fltr title (alist-get 'app_id w "")) + (funcall fltr title (alist-get 'title w "")))) ws))) (or (alist-get 'activated w) (seq-some (lambda (_ignored) @@ -101,12 +101,20 @@ (jao-tracking-set-log "")) (defun jao-river-toggle-emacs () - (if (or (member (jao-river-get-focused-app-id) '("emacs" "pemacs")) - (member (jao-river-get-focused-title) '("emacsclient" "emacs"))) - (jao-shell-exec "riverctl focus-previous-tags") - (jao-river-to-ws 1) - (unless (jao-river-focus-window "^p?emacs\\(client\\)?" t) - (jao-shell-exec* "riverctl" "spawn" "efoot")))) + (let ((erx "^p?emacs\\(client\\)?")) + (if (or (string-match-p erx (jao-river-get-focused-title)) + (string-match-p erx (jao-river-get-focused-app-id))) + (jao-shell-exec "riverctl focus-previous-tags") + (jao-river-to-ws 1) + (unless (jao-river-focus-window erx t) + (jao-shell-exec* "riverctl" "spawn" "efoot"))))) + +(defun jao-river-toggle-firefox () + (if (string-match-p "Firefox" (or (jao-river-get-focused-app-id) "")) + (jao-river-to-ws 1) + (jao-river-to-ws 2) + (unless (jao-river-focus-window "Firefox") + (jao-shell-exec* "riverctl" "spawn" "firefox")))) ;;; sway (defun jao-sway-msg (msg) -- cgit v1.2.3