From 230ce7a7c0ed0001dfe1e590f99c7bbaa90b346c Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 23 Sep 2022 01:03:51 +0100 Subject: sway tweaks --- lib/eos/jao-wayland.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/eos') diff --git a/lib/eos/jao-wayland.el b/lib/eos/jao-wayland.el index 5a457a4..8068dd7 100644 --- a/lib/eos/jao-wayland.el +++ b/lib/eos/jao-wayland.el @@ -118,16 +118,24 @@ (jao-sway-msg ,msg))) (jao-def-swaymsg firefox "[app_id=Firefox] focus") +(jao-def-swaymsg pemacs "[app_id=pemacs] focus") (defvar jao-sway-enabled (jao-shell-running-p "sway")) (defconst jao-sway-get-active-title "swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true).name'") +(defconst jao-sway-get-active-app + "swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true).app_id'") + (defun jao-sway-get-active-title () (let ((tl (jao-shell-string jao-sway-get-active-title))) (and (string-match "\"\\(.+\\)\"" tl) (match-string 1 tl)))) +(defun jao-sway-get-active-app () + (let ((tl (jao-shell-string jao-sway-get-active-app))) + (and (string-match "\"\\(.+\\)\"" tl) (match-string 1 tl)))) + (defun jao-sway-zathura-org () (jao-org-open-from-zathura (jao-sway-get-active-title) t)) @@ -152,5 +160,10 @@ (interactive) (jao-sway-run-or-focus "firefox")) +(defun jao-sway-toggle-emacs () + (if (string-match-p "p?emacs" (jao-sway-get-active-app)) + (jao-sway-firefox) + (jao-sway-pemacs))) + (provide 'jao-wayland) ;;; jao-wayland.el ends here -- cgit v1.2.3