From e7335de29ab69a9d0c58d519a35676781b9432de Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 4 Nov 2021 04:39:26 +0000 Subject: exwm: happier floating transient (it doesn't like lambdas) --- exwm.org | 75 ++++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 42 insertions(+), 33 deletions(-) diff --git a/exwm.org b/exwm.org index 69ec61d..e7336f9 100644 --- a/exwm.org +++ b/exwm.org @@ -441,45 +441,54 @@ #+end_src * Transients #+begin_src emacs-lisp + (defun jao-exwm--floating-p () exwm--floating-frame) + (defun jao-exwm--m0-5 () (interactive nil exwm-mode) (exwm-floating-move 0 -5)) + (defun jao-exwm--m05 () (interactive nil exwm-mode) (exwm-floating-move 0 5)) + (defun jao-exwm--m-50 () (interactive nil exwm-mode) (exwm-floating-move -5 0)) + (defun jao-exwm--m50 () (interactive nil exwm-mode) (exwm-floating-move 5 0)) + (defun jao-exwm--e-5 () (interactive nil exwm-mode) (exwm-layout-enlarge-window -5)) + (defun jao-exwm--e5 () (interactive nil exwm-mode) (exwm-layout-enlarge-window 5)) + (defun jao-exwm--eh5 () (interactive nil exwm-mode) (exwm-layout-enlarge-window 5 t)) + (defun jao-exwm--eh-5 () (interactive nil exwm-mode) (exwm-layout-enlarge-window -5 t)) + (defun jao-exwm--tl () (interactive nil exwm-mode) (jao-exwm--float-to 20 20)) + (defun jao-exwm--tr () (interactive nil exwm-mode) (jao-exwm--float-to -20 20)) + (defun jao-exwm--bl () (interactive nil exwm-mode) (jao-exwm--float-to 20 -20)) + (defun jao-exwm--br () (interactive nil exwm-mode) (jao-exwm--float-to -20 -20)) + + (defun jao-exwm--def-center-float () + (interactive) + (exwm-floating-toggle-floating) + (jao-exwm--center-float 900 600)) + (transient-define-prefix jao-transient-float () "Operations on EXWM floating windows." - ;; :transient-non-suffix 'transient--do-quit-one + :transient-non-suffix 'transient--do-quit-one [["Float" ("f" "float" exwm-floating-toggle-floating) ("F" "full" exwm-layout-toggle-fullscreen) ("c" "center" jao-exwm--center-float :if jao-exwm--floating-p) - ("C" "center-float" jao-exwm--def-center-float)] - ["Slide" - :if jao-exwm--floating-p - ("k" "up" (lambda () (interactive) (exwm-floating-move 0 -5)) - :transient t) - ("j" "down" (lambda () (interactive) (exwm-floating-move 0 5)) - :transient t) - ("h" "left" (lambda () (interactive) (exwm-floating-move -5 0)) - :transient t) - ("l" "right" (lambda () (interactive) (exwm-floating-move 5 0)) - :transient t)] - ["Resize" - :if jao-exwm--floating-p - ("K" "up" - (lambda () (interactive) (exwm-layout-enlarge-window 5)) :transient t) - ("J" "down" - (lambda () (interactive) (exwm-layout-enlarge-window -5)) :transient t) - ("H" "left" jao-exwm-enlarge-0-5 - (lambda () (interactive) (exwm-layout-enlarge-window 5 t)) :transient t) - ("L" "right" - (lambda () (interactive) (exwm-layout-enlarge-window -5 t)) - :transient t)] - ["Nudge" - :if jao-exwm--floating-p - ("tl" "top-left" - (lambda () (interactive) (jao-exwm--float-to 20 20))) - ("tr" "top-right" - (lambda () (interactive) (jao-exwm--float-to -20 20))) - ("bl" "bottom-left" - (lambda () (interactive) (jao-exwm--float-to 20 -20))) - ("br" "bottom-right " - (lambda () (interactive) (jao-exwm--float-to -20 -20)))]]) + ("c" "float and resize" jao-exwm--def-center-float + :if-not jao-exwm--floating-p) + ("x" "hide" exwm-floating-hide :if jao-exwm--floating-p)] + ["Slide" :if jao-exwm--floating-p + ("k" "up" jao-exwm--m0-5 :transient t) + ("j" "down" jao-exwm--m05 :transient t) + ("h" "left" jao-exwm--m-50 :transient t) + ("l" "right" jao-exwm--m50 :transient t)] + ["Resize" :if jao-exwm--floating-p + ("K" "up" jao-exwm--e5 :transient t) + ("J" "down" jao-exwm--e-5 :transient t) + ("H" "left" jao-exwm--eh5 :transient t) + ("L" "right" jao-exwm--eh-5 :transient t)] + ["Nudge" :if jao-exwm--floating-p + ("t" "top-left" jao-exwm--tl) + ("T" "top-right" jao-exwm--tr) + ("b" "bottom-left" jao-exwm--bl) + ("B" "bottom-right " jao-exwm--br)]]) + + (defun jao-exwm--buffer () + (interactive) + (jao-buffer-same-mode 'exwm-mode nil 'exwm-workspace-switch-to-buffer)) (transient-define-prefix jao-transient-exwm () "Global operations in EXWM." -- cgit v1.2.3