[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/exwm 3f2f844 58/64: Add a command to interactively move
From: |
Chris Feng |
Subject: |
[elpa] externals/exwm 3f2f844 58/64: Add a command to interactively move X window to the current workspace |
Date: |
Thu, 17 Sep 2015 23:18:11 +0000 |
branch: externals/exwm
commit 3f2f84456997a46e047adbf45c4c44b628ae1377
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>
Add a command to interactively move X window to the current workspace
* exwm-workspace.el (exwm-workspace-move-window): Hide buffer on the
original
Emacs window when moving an X window to the current workspace.
* exwm-workspace.el: New function exwm-workspace-switch-to-window for
interactively moving an X window on another workspace to the current one.
---
exwm-workspace.el | 31 +++++++++++++++++++++++++++++--
1 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/exwm-workspace.el b/exwm-workspace.el
index 2ea8d1f..5fae713 100644
--- a/exwm-workspace.el
+++ b/exwm-workspace.el
@@ -174,7 +174,7 @@ The optional FORCE option is for internal use only."
(user-error "[EXWM] Workspace index out of range: %d" index))
(with-current-buffer (exwm--id->buffer id)
(let ((frame (elt exwm-workspace--list index)))
- (when (not (equal exwm--frame frame))
+ (unless (eq exwm--frame frame)
(let ((name (replace-regexp-in-string "^\\s-*" "" (buffer-name))))
(exwm-workspace-rename-buffer
(if (= index exwm-workspace-current-index) name (concat " " name))))
@@ -191,7 +191,12 @@ The optional FORCE option is for internal use only."
:x 0 :y 0))
(xcb:flush exwm--connection))
;; Move the window itself
- (bury-buffer)
+ (if (/= index exwm-workspace-current-index)
+ (bury-buffer)
+ (set-window-buffer (get-buffer-window (current-buffer) t)
+ (or (get-buffer "*scratch*")
+ (prog1 (get-buffer-create "*scratch*")
+ (set-buffer-major-mode "*scratch*")))))
(exwm-layout--hide id)
(xcb:+request exwm--connection
(make-instance 'xcb:ReparentWindow
@@ -203,6 +208,28 @@ The optional FORCE option is for internal use only."
(exwm--id->buffer id)))))
(exwm-workspace--update-switch-history)))
+(defun exwm-workspace-switch-to-window ()
+ "Make the current Emacs window display another X window."
+ (interactive)
+ ;; Show all buffers
+ (dolist (pair exwm--id-buffer-alist)
+ (with-current-buffer (cdr pair)
+ (when (= ?\s (aref (buffer-name) 0))
+ (rename-buffer (substring (buffer-name) 1)))))
+ (let ((buffer (read-buffer "Switch to window: " nil t)))
+ (when buffer
+ (with-current-buffer buffer
+ (when (and (eq major-mode 'exwm-mode)
+ (not (eq exwm--frame exwm-workspace--current)))
+ (exwm-workspace-move-window exwm-workspace-current-index
+ exwm--id)))))
+ ;; Hide buffers on other workspaces
+ (dolist (pair exwm--id-buffer-alist)
+ (with-current-buffer (cdr pair)
+ (unless (or (eq exwm--frame exwm-workspace--current)
+ (= ?\s (aref (buffer-name) 0)))
+ (rename-buffer (concat " " (buffer-name)))))))
+
(defun exwm-workspace-rename-buffer (newname)
"Rename a buffer."
(let ((hidden (= ?\s (aref newname 0)))
- [elpa] externals/exwm f7bec7a 51/64: Minor fix, (continued)
- [elpa] externals/exwm f7bec7a 51/64: Minor fix, Chris Feng, 2015/09/17
- [elpa] externals/exwm 5222dc1 49/64: Avoid deleting the frame created by Emacs client by accident, Chris Feng, 2015/09/17
- [elpa] externals/exwm f1d37b9 53/64: Ungrab pointer timely when resizing is aborted, Chris Feng, 2015/09/17
- [elpa] externals/exwm 76f4849 50/64: Drop intro to xelb-util, Chris Feng, 2015/09/17
- [elpa] externals/exwm 9eee94e 52/64: Merge pull request #52 from pipcet/minor-fix, Chris Feng, 2015/09/17
- [elpa] externals/exwm 637ac15 55/64: Code cleanups, Chris Feng, 2015/09/17
- [elpa] externals/exwm b50a6e6 45/64: Correct several EWMH properties, Chris Feng, 2015/09/17
- [elpa] externals/exwm 5373c1d 57/64: Add support for xcb:Atom:_NET_CLIENT_LIST_STACKING etc, Chris Feng, 2015/09/17
- [elpa] externals/exwm eafd031 56/64: Allow hide/show mode-line on floating frames, Chris Feng, 2015/09/17
- [elpa] externals/exwm 1d43515 59/64: Allow switch to normal buffers in exwm-workspace-switch-to-window, Chris Feng, 2015/09/17
- [elpa] externals/exwm 3f2f844 58/64: Add a command to interactively move X window to the current workspace,
Chris Feng <=
- [elpa] externals/exwm cfbd9a5 61/64: Minor fix for window move, Chris Feng, 2015/09/17
- [elpa] externals/exwm 576a676 62/64: Fix with-slots, Chris Feng, 2015/09/17
- [elpa] externals/exwm dbcabe7 60/64: Implement move/resize with keyboard, Chris Feng, 2015/09/17
- [elpa] externals/exwm 10a7fe8 01/64: First commit, Chris Feng, 2015/09/17
- [elpa] externals/exwm 4255f07 64/64: On-demand update exwm-workspace--switch-history, Chris Feng, 2015/09/17
- [elpa] externals/exwm 6d63c71 54/64: Prepare for GNU ELPA release, Chris Feng, 2015/09/17
- [elpa] externals/exwm b458d5a 63/64: Allow showing buffers on other workspaces and moving an X window by switching, Chris Feng, 2015/09/17