summaryrefslogtreecommitdiffhomepage
path: root/init.el
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-09-07 05:33:28 +0100
committerjao <jao@gnu.org>2022-09-07 05:33:28 +0100
commit0986db35bb51d5b3426a0aad9467bd3b1765358d (patch)
treed49f81396f295e7197337e8f708dabb2ec4ba95d /init.el
parentaea99a7fecc5d873991990057ba02479f5b9b1b1 (diff)
downloadelibs-0986db35bb51d5b3426a0aad9467bd3b1765358d.tar.gz
elibs-0986db35bb51d5b3426a0aad9467bd3b1765358d.tar.bz2
jao-river-toggle-emacs
Diffstat (limited to 'init.el')
-rw-r--r--init.el14
1 files changed, 11 insertions, 3 deletions
diff --git a/init.el b/init.el
index f068a78..de13c05 100644
--- a/init.el
+++ b/init.el
@@ -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))