mirror of
https://github.com/ch11ng/exwm.git
synced 2024-11-27 13:07:59 +01:00
Fix buffer switch problems
* Prevent switching to floating windows or windows on other workspaces * Provide a workaround for `ido-mode` (can be enabled with `(exwm-enable-ido-workaround)`)
This commit is contained in:
parent
b755296f54
commit
801185c7cc
2 changed files with 31 additions and 1 deletions
|
@ -198,7 +198,13 @@
|
||||||
(exwm-layout--hide exwm--id)
|
(exwm-layout--hide exwm--id)
|
||||||
(exwm-layout--show exwm--id (car windows))
|
(exwm-layout--show exwm--id (car windows))
|
||||||
(dolist (i (cdr windows))
|
(dolist (i (cdr windows))
|
||||||
(set-window-buffer i placeholder)))))))))
|
(set-window-buffer i placeholder))))))
|
||||||
|
;; Make sure windows floating / on other workspaces are excluded
|
||||||
|
(dolist (window (window-list frame 0))
|
||||||
|
(with-current-buffer (window-buffer window)
|
||||||
|
(when (and (eq major-mode 'exwm-mode)
|
||||||
|
(or exwm--floating-frame (not (eq frame exwm--frame))))
|
||||||
|
(set-window-buffer window placeholder)))))))
|
||||||
|
|
||||||
(defun exwm-layout--on-minibuffer-setup ()
|
(defun exwm-layout--on-minibuffer-setup ()
|
||||||
"Refresh layout when minibuffer grows."
|
"Refresh layout when minibuffer grows."
|
||||||
|
|
24
exwm.el
24
exwm.el
|
@ -707,6 +707,30 @@
|
||||||
(add-hook 'window-setup-hook 'exwm-init t) ;for Emacs
|
(add-hook 'window-setup-hook 'exwm-init t) ;for Emacs
|
||||||
(add-hook 'after-make-frame-functions 'exwm-init t))) ;for Emacs Client
|
(add-hook 'after-make-frame-functions 'exwm-init t))) ;for Emacs Client
|
||||||
|
|
||||||
|
(defun exwm--ido-buffer-window-other-frame (orig-fun buffer)
|
||||||
|
"Wrapper for `ido-buffer-window-other-frame' to exclude invisible windows."
|
||||||
|
(let* ((window (funcall orig-fun buffer))
|
||||||
|
(frame (window-frame window)))
|
||||||
|
;; Exclude windows on other workspaces
|
||||||
|
(unless (and (memq frame exwm-workspace--list)
|
||||||
|
(not (eq frame exwm-workspace--current)))
|
||||||
|
window)))
|
||||||
|
|
||||||
|
(defun exwm--fix-ido-buffer-window-other-frame ()
|
||||||
|
"Fix `ido-buffer-window-other-frame'."
|
||||||
|
(advice-add 'ido-buffer-window-other-frame :around
|
||||||
|
'exwm--ido-buffer-window-other-frame))
|
||||||
|
|
||||||
|
(defun exwm-enable-ido-workaround ()
|
||||||
|
"Enable workarounds for `ido-mode'."
|
||||||
|
(add-hook 'exwm-init-hook 'exwm--fix-ido-buffer-window-other-frame))
|
||||||
|
|
||||||
|
(defun exwm-disable-ido-workaround ()
|
||||||
|
"Disable workarounds for `ido-mode'."
|
||||||
|
(remove-hook 'exwm-init-hook 'exwm--fix-ido-buffer-window-other-frame)
|
||||||
|
(advice-remove 'ido-buffer-window-other-frame
|
||||||
|
'exwm--ido-buffer-window-other-frame))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(provide 'exwm)
|
(provide 'exwm)
|
||||||
|
|
Loading…
Reference in a new issue