summaryrefslogtreecommitdiffhomepage
path: root/lib/eos
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-09-23 01:03:51 +0100
committerjao <jao@gnu.org>2022-09-23 01:04:05 +0100
commit230ce7a7c0ed0001dfe1e590f99c7bbaa90b346c (patch)
tree9adec6680e9f097103939f5834ee6407670c34ac /lib/eos
parent2df3fe0fdf6aa61b5f5da3f1b623742d66395fb6 (diff)
downloadelibs-230ce7a7c0ed0001dfe1e590f99c7bbaa90b346c.tar.gz
elibs-230ce7a7c0ed0001dfe1e590f99c7bbaa90b346c.tar.bz2
sway tweaks
Diffstat (limited to 'lib/eos')
-rw-r--r--lib/eos/jao-wayland.el13
1 files changed, 13 insertions, 0 deletions
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