about summary refs log tree commit diff
path: root/users/wpcarro/emacs
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2022-02-15T19·46-0800
committerclbot <clbot@tvl.fyi>2022-02-15T19·49+0000
commit7e65edcb16d2aafa2240bda5d4b255f499ff7e4a (patch)
tree591e5fe55bb99cd2aa9eb854b9cee8283ee02458 /users/wpcarro/emacs
parent36f6322d16ad0c2341bc37235bf327db516ef97d (diff)
feat(wpcarro/emacs): Define window-manager-move-window r/3835
Move the current window to a new named EXWM workspace and focus that workspace.

Change-Id: Ibb3d3b3df09c6853d2eaf02882714a5c62623d2b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5293
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: wpcarro <wpcarro@gmail.com>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/wpcarro/emacs')
-rw-r--r--users/wpcarro/emacs/.emacs.d/wpc/window-manager.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/users/wpcarro/emacs/.emacs.d/wpc/window-manager.el b/users/wpcarro/emacs/.emacs.d/wpc/window-manager.el
index 308424cc54d8..4c61138f948a 100644
--- a/users/wpcarro/emacs/.emacs.d/wpc/window-manager.el
+++ b/users/wpcarro/emacs/.emacs.d/wpc/window-manager.el
@@ -209,5 +209,20 @@ predicate."
                      t)
     window-manager-named-workspaces)))
 
+(defun window-manager-move-window ()
+  "Prompt the user to move the current window to another workspace."
+  (interactive)
+  (let ((window (get-buffer-window))
+        (dest (completing-read "Move current window to: "
+                               (->> window-manager-named-workspaces
+                                    (-map #'window-manager-named-workspace-label))
+                               nil
+                               t)))
+    (exwm-workspace-move-window
+     (exwm-workspace--workspace-from-frame-or-index
+      (window-manager--label->index dest window-manager-named-workspaces))
+     (exwm--buffer->id window))
+    (window-manager--switch dest)))
+
 (provide 'window-manager)
 ;;; window-manager.el ends here