summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--init.el26
1 files changed, 14 insertions, 12 deletions
diff --git a/init.el b/init.el
index 1d88548..38e9c86 100644
--- a/init.el
+++ b/init.el
@@ -456,7 +456,8 @@
`(defun ,(intern (format "jao-sway-%s" name)) ()
(interactive)
(jao-swaymsg ,msg)))
-(jao-def-swaymsg firefox "[app_id=firefox] focus")
+
+(jao-def-swaymsg firefox "[app_id=Firefox] focus")
(defvar jao-sway-enabled
(string= "wayland" (or (getenv "XDG_SESSION_TYPE") "")))
@@ -471,20 +472,21 @@
(defun jao-sway-zathura-org ()
(jao-pdf-goto-zathura-org (jao-sway-get-active-title) t))
-(defun jao-sway-send (txt) (jao-shell-string "wtype" txt))
+(defun jao-sway-send (&rest args) (apply 'jao-shell-string "wtype" args))
-(defun jao-zathura--open-cmd (file page &optional suffix)
- (let ((page (if page (format "-P %s" page) "")))
- (format "zathura %s %s %s" file page (or suffix ""))))
+(defun jao-sway-switch-layout ()
+ (sit-for 0.2)
+ (let ((n (length (split-string (jao-shell-string "pidof zathura") " "))))
+ (cond ((= n 1) (jao-sway-send "-M" "win" "b"))
+ ((= n 2) (jao-sway-send "-M" "win" "lv"))
+ ((= n 3) (jao-sway-send "-M" "win" "S")))))
(defun jao-sway-open-with-zathura (file page)
- (let* ((a (jao-zathura--open-cmd file page ""))
- (n (file-name-nondirectory file))
- (f (format "swaymsg -r [title=\"%s\"] focus" n))
- (c (format "%s || %s" f a)))
- (jao-shell-exec c)
- (sit-for 0.2)
- (jao-shell-exec f)
+ (let ((n (file-name-nondirectory file)))
+ (jao-swaymsg "workspace number 3")
+ (unless (= 0 (jao-swaymsg (format "[title=\"%s\"] focus" n)))
+ (jao-shell-exec (jao-pdf-zathura-open-cmd file page "")))
+ ;; (jao-sway-switch-layout)
(when page (sit-for 0.2) (jao-sway-send (format "%dg" page)))))
(defun jao-sway-set-wallpaper (f)