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.
This commit is contained in:
parent
8a1c3761e4
commit
3763195fe3
2 changed files with 15 additions and 0 deletions
|
@ -240,6 +240,17 @@
|
||||||
(xcb:flush exwm--connection)))
|
(xcb:flush exwm--connection)))
|
||||||
(cl-incf exwm-layout--fullscreen-frame-count))
|
(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
|
(defvar exwm-layout-show-all-buffers nil
|
||||||
"Non-nil to allow switching to buffers on other workspaces.")
|
"Non-nil to allow switching to buffers on other workspaces.")
|
||||||
|
|
||||||
|
|
|
@ -235,6 +235,7 @@ The optional FORCE option is for internal use only."
|
||||||
(declare-function exwm-layout--show "exwm-layout.el" (id &optional window))
|
(declare-function exwm-layout--show "exwm-layout.el" (id &optional window))
|
||||||
(declare-function exwm-layout--hide "exwm-layout.el" (id))
|
(declare-function exwm-layout--hide "exwm-layout.el" (id))
|
||||||
(declare-function exwm-layout--refresh "exwm-layout.el")
|
(declare-function exwm-layout--refresh "exwm-layout.el")
|
||||||
|
(declare-function exwm-layout--other-buffer-predicate "exwm-layout.el" (buffer))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun exwm-workspace-move-window (index &optional id)
|
(defun exwm-workspace-move-window (index &optional id)
|
||||||
|
@ -684,6 +685,9 @@ The optional FORCE option is for internal use only."
|
||||||
;; The default behavior of `display-buffer' (indirectly called by
|
;; The default behavior of `display-buffer' (indirectly called by
|
||||||
;; `minibuffer-completion-help') is not correct here.
|
;; `minibuffer-completion-help') is not correct here.
|
||||||
(cl-pushnew '(exwm-workspace--display-buffer) display-buffer-alist))
|
(cl-pushnew '(exwm-workspace--display-buffer) display-buffer-alist))
|
||||||
|
;; Prevent `other-buffer' from selecting already displayed EXWM buffers.
|
||||||
|
(modify-all-frames-parameters
|
||||||
|
'((buffer-predicate . exwm-layout--other-buffer-predicate)))
|
||||||
;; Configure workspaces
|
;; Configure workspaces
|
||||||
(dolist (i exwm-workspace--list)
|
(dolist (i exwm-workspace--list)
|
||||||
(let ((outer-id (string-to-number (frame-parameter i 'outer-window-id)))
|
(let ((outer-id (string-to-number (frame-parameter i 'outer-window-id)))
|
||||||
|
|
Loading…
Reference in a new issue