diff options
-rw-r--r-- | init.el | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -485,14 +485,15 @@ (defsubst jao-river-get-focused-title () (alist-get 'title (jao-river-focused))) -(defun jao-river-focus-window (title) +(defun jao-river-focus-window (title &optional rx) (let* ((ws (jao-river-window-list)) - (w (seq-some (lambda (w) (and (equal title (alist-get 'title w)) w)) + (fltr (if rx #'string-match-p #'string=) ) + (w (seq-find (lambda (w) (funcall fltr title (alist-get 'title w ""))) ws))) (or (alist-get 'activated w) (seq-some (lambda (_ignored) (jao-shell-exec "riverctl focus-view next" t) - (equal title (jao-river-get-focused-title))) + (funcall fltr title (jao-river-get-focused-title))) (and w ws))))) (defun jao-river-zathura-to-org () @@ -538,6 +539,13 @@ (jao-tracking-set-log "")) (message "Welcome to river")) +(defun jao-river-toggle-emacs () + (if (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 "^emacs\\(client\\)?" t) + (jao-shell-exec* "riverctl" "spawn" "efoot")))) + (when jao-river-enabled (add-hook 'after-init-hook #'jao-river-enable)) |