Allow showing buffers on other workspaces and moving an X window by switching
to its buffer * exwm-workspace.el (exwm-workspace-show-all-buffers, exwm-workspace-switch) (exwm-workspace-move-window, exwm-workspace-switch-to-buffer): Show buffers on other workspaces if `exwm-workspace-show-all-buffers' is non-nil. * exwm-layout.el (exwm-layout-show-all-buffers, exwm-layout--refresh): Allow moving an X window by switch to its corresponding buffer from another workspace when `exwm-layout-show-all-buffers' is non-nil. * exwm.el (exwm--ido-buffer-window-other-frame): Handle the case when `exwm-layout-show-all-buffers' is non-nil. * exwm-floating.el (exwm-floating--set-floating): Handle the case when *scratch* buffer is killed. * exwm-workspace.el (exwm-workspace-switch-to-buffer): Renamed from `exwm-workspace-switch-to-window' to better reflect its role.
This commit is contained in:
parent
576a676f1f
commit
b458d5ac30
4 changed files with 58 additions and 33 deletions
|
|
@ -194,10 +194,15 @@
|
|||
:height height))
|
||||
(xcb:flush exwm--connection))))
|
||||
|
||||
(defvar exwm-layout-show-all-buffers nil
|
||||
"Non-nil to allow switching to buffers on other workspaces.")
|
||||
|
||||
(defun exwm-layout--refresh ()
|
||||
"Refresh layout."
|
||||
(let ((frame (selected-frame))
|
||||
(placeholder (get-buffer "*scratch*"))
|
||||
(placeholder (or (get-buffer "*scratch*")
|
||||
(prog1 (get-buffer-create "*scratch*")
|
||||
(set-buffer-major-mode "*scratch*"))))
|
||||
windows)
|
||||
(if (not (memq frame exwm-workspace--list))
|
||||
(if (frame-parameter frame 'exwm-window-id)
|
||||
|
|
@ -221,19 +226,25 @@
|
|||
;; Refresh the whole workspace
|
||||
;; Workspaces other than the active one can also be refreshed (RandR)
|
||||
(exwm--log "Refresh workspace %s" frame)
|
||||
(unless placeholder ;create the *scratch* buffer if it's killed
|
||||
(setq placeholder (get-buffer-create "*scratch*"))
|
||||
(set-buffer-major-mode placeholder))
|
||||
(dolist (pair exwm--id-buffer-alist)
|
||||
(with-current-buffer (cdr pair)
|
||||
;; Exclude windows on other workspaces and floating frames
|
||||
(when (and (eq frame exwm--frame) (not exwm--floating-frame))
|
||||
(when (and (not exwm--floating-frame) ;exclude floating X windows
|
||||
(or exwm-layout-show-all-buffers
|
||||
;; Exclude X windows on other workspaces
|
||||
(eq frame exwm--frame)))
|
||||
(setq windows (get-buffer-window-list (current-buffer) 0))
|
||||
(if (not windows)
|
||||
(exwm-layout--hide exwm--id)
|
||||
(exwm-layout--show exwm--id (car windows))
|
||||
(dolist (i (cdr windows))
|
||||
(set-window-buffer i placeholder))))))
|
||||
(when (eq frame exwm--frame) ;for exwm-layout-show-all-buffers
|
||||
(exwm-layout--hide exwm--id))
|
||||
(if (eq frame exwm--frame)
|
||||
(exwm-layout--show exwm--id (car windows))
|
||||
(exwm-workspace-move-window
|
||||
(cl-position frame exwm-workspace--list) exwm--id))
|
||||
(let ((window (car windows)))
|
||||
;; Make sure this buffer is not displayed elsewhere
|
||||
(dolist (i (get-buffer-window-list (current-buffer) 0 t))
|
||||
(unless (eq i window)
|
||||
(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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue