about summary refs log tree commit diff
path: root/exwm-workspace.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2016-02-25T10·36+0800
committerChris Feng <chris.w.feng@gmail.com>2016-02-25T10·36+0800
commit84a9041b20e5477fb2ce2989de9dd2583ef12773 (patch)
tree5fa7c5becca2f9363bffd4b2d3be39086838d0f9 /exwm-workspace.el
parentb400ae6eba75e61085b46a1671b52290e3ba30a2 (diff)
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.
Diffstat (limited to 'exwm-workspace.el')
-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)