From c351aa5af4782f1f7a2dcbd09c4482e6ec884360 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Sat, 12 Feb 2022 22:41:56 -0800 Subject: feat(wpcarro/emacs): define window-manager-workspace-move 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 Autosubmit: wpcarro --- users/wpcarro/emacs/.emacs.d/wpc/window-manager.el | 25 ++++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'users') 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 -- cgit 1.4.1