Skip to content

make exwm-workspace-switch-to-buffer switch workspaces #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions exwm-workspace.el
Original file line number Diff line number Diff line change
Expand Up @@ -772,10 +772,10 @@ INDEX must not exceed the current number of workspaces."

;;;###autoload
(defun exwm-workspace-switch-to-buffer (buffer-or-name)
"Make the current Emacs window display another buffer."
"Switch to a workspace displaying the given buffer."
(interactive
(let ((inhibit-quit t))
;; Show all buffers
;; Show all buffers temporarily.
(unless exwm-workspace-show-all-buffers
(dolist (pair exwm--id-buffer-alist)
(with-current-buffer (cdr pair)
Expand All @@ -784,7 +784,7 @@ INDEX must not exceed the current number of workspaces."
(prog1
(with-local-quit
(list (get-buffer (read-buffer-to-switch "Switch to buffer: "))))
;; Hide buffers on other workspaces
;; Hide buffers on other workspaces again.
(unless exwm-workspace-show-all-buffers
(dolist (pair exwm--id-buffer-alist)
(with-current-buffer (cdr pair)
Expand All @@ -793,20 +793,20 @@ INDEX must not exceed the current number of workspaces."
(rename-buffer (concat " " (buffer-name))))))))))
(when buffer-or-name
(with-current-buffer buffer-or-name
(if (eq major-mode 'exwm-mode)
;; EXWM buffer.
(if (eq exwm--frame exwm-workspace--current)
;; On the current workspace.
(if (not exwm--floating-frame)
(switch-to-buffer buffer-or-name)
;; Select the floating frame.
(select-frame-set-input-focus exwm--floating-frame)
(select-window (frame-root-window exwm--floating-frame)))
;; On another workspace.
(exwm-workspace-move-window exwm-workspace--current
exwm--id))
;; Ordinary buffer.
(switch-to-buffer buffer-or-name)))))
(if (not (eq major-mode 'exwm-mode))
;; Ordinary buffer.
(let ((window (get-buffer-window buffer-or-name t)))
(if window
(select-window window)
(switch-to-buffer buffer-or-name)))
;; EXWM buffer.
(unless (eq exwm--frame exwm-workspace--current)
(exwm-workspace-switch exwm--frame))
(if (not exwm--floating-frame)
(switch-to-buffer buffer-or-name)
;; Select the floating frame.
(select-frame-set-input-focus exwm--floating-frame)
(select-window (frame-root-window exwm--floating-frame)))))))

(defun exwm-workspace-rename-buffer (newname)
"Rename a buffer."
Expand Down