Define window-manager-swap-workspaces

This is a wrapper around the existing `exwm-workspace-swap` except it's aware of
my `window-manager-workspace` struct.
This commit is contained in:
William Carroll 2020-10-03 14:49:33 +01:00
parent 869bcf3fc8
commit b4b929a55b

View file

@ -375,6 +375,22 @@ predicate."
cycle-current
window-manager--named-workspace-label))
(defun window-manager-swap-workspaces ()
"Prompt the user to switch the current workspace with 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))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Startup Applications in `window-manager--named-workspaces'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;