From 84a9041b20e5477fb2ce2989de9dd2583ef12773 Mon Sep 17 00:00:00 2001 From: Chris Feng Date: Thu, 25 Feb 2016 18:36:54 +0800 Subject: [PATCH] Fix exwm-workspace-switch-to-buffer * exwm-workspace.el (exwm-workspace-switch-to-buffer): Select the floating frame when switching to a floating X window buffer. --- exwm-workspace.el | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/exwm-workspace.el b/exwm-workspace.el index 80767d5..8230bd7 100644 --- a/exwm-workspace.el +++ b/exwm-workspace.el @@ -399,10 +399,19 @@ The optional FORCE option is for internal use only." (rename-buffer (concat " " (buffer-name)))))))))) (when buffer-or-name (with-current-buffer buffer-or-name - (if (and (eq major-mode 'exwm-mode) - (not (eq exwm--frame exwm-workspace--current))) - (exwm-workspace-move-window exwm-workspace-current-index - exwm--id) + (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-index + exwm--id)) + ;; Ordinary buffer. (switch-to-buffer buffer-or-name))))) (defun exwm-workspace-rename-buffer (newname)