about summary refs log tree commit diff
path: root/users/wpcarro/emacs/.emacs.d/wpc/window-manager.el
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2022-02-13T06·41-0800
committerclbot <clbot@tvl.fyi>2022-02-13T06·47+0000
commitc351aa5af4782f1f7a2dcbd09c4482e6ec884360 (patch)
tree8ff02456cadac0b686b0ba401989f9bb47f0c622 /users/wpcarro/emacs/.emacs.d/wpc/window-manager.el
parent9d0e7a9ff035636662d75d159c471d7e2e219ce0 (diff)
feat(wpcarro/emacs): define window-manager-workspace-move r/3811
Wrapper around `exwm-workspace-move` but uses `completing-read` and understands
my named-workspace structs.

Change-Id: Ibe565b3afaeec5c4a7f2b6d2d0c9c21bc8006962
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5275
Tested-by: BuildkiteCI
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: wpcarro <wpcarro@gmail.com>
Diffstat (limited to 'users/wpcarro/emacs/.emacs.d/wpc/window-manager.el')
-rw-r--r--users/wpcarro/emacs/.emacs.d/wpc/window-manager.el25
1 files changed, 11 insertions, 14 deletions
diff --git a/users/wpcarro/emacs/.emacs.d/wpc/window-manager.el b/users/wpcarro/emacs/.emacs.d/wpc/window-manager.el
index 6e0097926157..308424cc54d8 100644
--- a/users/wpcarro/emacs/.emacs.d/wpc/window-manager.el
+++ b/users/wpcarro/emacs/.emacs.d/wpc/window-manager.el
@@ -196,21 +196,18 @@ predicate."
        cycle-current
        window-manager-named-workspace-label))
 
-(defun window-manager-swap-workspaces ()
-  "Prompt the user to switch the current workspace with another."
+(defun window-manager-workspace-move ()
+  "Prompt the user to move the current workspace to another."
   (interactive)
-  (let* ((selection (->> window-manager-named-workspaces
-                         (-map #'window-manager-named-workspace-label)
-                         (-reject
-                          (lambda (x)
-                            (s-equals? x (window-manager-current-workspace))))
-                         (completing-read
-                          (format "Swap current workspace (i.e. \"%s\") with: "
-                                  (window-manager-current-workspace)))))
-         (i (-find-index (lambda (x)
-                           (s-equals? selection (window-manager-named-workspace-label x)))
-                                 window-manager-named-workspaces)))
-    (exwm-workspace-swap exwm-workspace--current (elt exwm-workspace--list i))))
+  (exwm-workspace-move
+   exwm-workspace--current
+   (window-manager--label->index
+    (completing-read "Move current workspace to: "
+                     (->> window-manager-named-workspaces
+                          (-map #'window-manager-named-workspace-label))
+                     nil
+                     t)
+    window-manager-named-workspaces)))
 
 (provide 'window-manager)
 ;;; window-manager.el ends here