about summary refs log tree commit diff
path: root/exwm-layout.el
diff options
context:
space:
mode:
authorAdrián Medraño Calvo <adrian@medranocalvo.com>2016-03-19T00·00+0000
committerAdrián Medraño Calvo <adrian@medranocalvo.com>2016-03-19T00·00+0000
commit3763195fe3205090e1f405970421662523b7df7e (patch)
tree426995d6e0079b09de9a57d6ca99d0169f7613dc /exwm-layout.el
parent8a1c3761e4eab018a001dcc522112269f83ba279 (diff)
Use `buffer-predicate' frame parameter to prevent switching to visible EXWM buffers
* exwm-layout.el (exwm-layout--other-buffer-predicate): New
function to be set as `buffer-predicate' frame parameter.
* exwm-workspace.el (exwm-workspace--init): Use above function on
workspace frames.
Diffstat (limited to 'exwm-layout.el')
-rw-r--r--exwm-layout.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/exwm-layout.el b/exwm-layout.el
index d084c96e44..b0b9467750 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -240,6 +240,17 @@
       (xcb:flush exwm--connection)))
   (cl-incf exwm-layout--fullscreen-frame-count))
 
+(defun exwm-layout--other-buffer-predicate (buffer)
+  "Return non-nil when the BUFFER may be displayed in selected frame.
+
+Prevents EXWM-mode buffers already being displayed on some other window from
+being selected.
+
+Should be set as `buffer-predicate' frame parameter for all
+frames.  Used by `other-buffer'."
+  (not (and (eq 'exwm-mode (buffer-local-value 'major-mode buffer))
+            (get-buffer-window buffer t))))
+
 (defvar exwm-layout-show-all-buffers nil
   "Non-nil to allow switching to buffers on other workspaces.")