summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lib/eos/jao-wayland.el20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/eos/jao-wayland.el b/lib/eos/jao-wayland.el
index 8de32cc..9f503f8 100644
--- a/lib/eos/jao-wayland.el
+++ b/lib/eos/jao-wayland.el
@@ -46,15 +46,21 @@
(defsubst jao-river-get-focused-title ()
(alist-get 'title (jao-river-focused)))
+(defsubst jao-river-get-focused-app-id ()
+ (alist-get 'app_id (jao-river-focused)))
+
(defun jao-river-focus-window (title &optional rx)
(let* ((ws (jao-river-window-list))
(fltr (if rx #'string-match-p #'string=) )
- (w (seq-find (lambda (w) (funcall fltr title (alist-get 'title w "")))
+ (w (seq-find (lambda (w)
+ (or (funcall fltr title (alist-get 'title w ""))
+ (funcall fltr title (alist-get 'app_id w ""))))
ws)))
(or (alist-get 'activated w)
(seq-some (lambda (_ignored)
(jao-shell-exec "riverctl focus-view next" t)
- (funcall fltr title (jao-river-get-focused-title)))
+ (or (funcall fltr title (jao-river-get-focused-app-id))
+ (funcall fltr title (jao-river-get-focused-title))))
(and w ws)))))
(defun jao-river-zathura-to-org ()
@@ -95,10 +101,11 @@
(jao-tracking-set-log ""))
(defun jao-river-toggle-emacs ()
- (if (member (jao-river-get-focused-title) '("emacsclient" "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 "^emacs\\(client\\)?" t)
+ (unless (jao-river-focus-window "^p?emacs\\(client\\)?" t)
(jao-shell-exec* "riverctl" "spawn" "efoot"))))
;;; sway
@@ -125,9 +132,10 @@
(jao-pdf-goto-zathura-org (jao-sway-get-active-title) t))
(defun jao-sway-open-with-zathura (file page)
- (let ((n (file-name-nondirectory file)))
+ (let* ((n (file-name-nondirectory file))
+ (m (format "[title=\"%s\" app_id=\".*zathura\"] focus" n)))
(jao-sway-msg "workspace number 3")
- (unless (= 0 (jao-sway-msg (format "[title=\"%s\"] focus" n)))
+ (unless (= 0 (jao-sway-msg m))
(jao-shell-exec (jao-pdf-zathura-open-cmd file page)))
(when page (sit-for 0.2) (jao-wayland-type (format "%dg" page)))))