about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--exwm-workspace.el17
1 files changed, 13 insertions, 4 deletions
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 80767d52d701..8230bd7628c1 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)