about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2018-03-23T15·49+0800
committerChris Feng <chris.w.feng@gmail.com>2018-03-23T15·51+0800
commitb6d660042e8f949890e6b4d5c397235d1653fdfe (patch)
tree29d20b567e9f86eb320c4d7944e0310b199ecb51
parent5448fb75fac0bfa56e15c8f3630fafc24c07f109 (diff)
Add workspace support in per-application configurations
* exwm-manage.el (exwm-manage-configurations)
(exwm-manage--manage-window): Allow to specify which workspace an
applications should be created on.
-rw-r--r--exwm-manage.el12
1 files changed, 9 insertions, 3 deletions
diff --git a/exwm-manage.el b/exwm-manage.el
index 3e47f749c909..f44071020d2d 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -69,6 +69,7 @@ You can still make the X windows floating afterwards."
                         (const :tag "Char-mode" char-mode)
                         (const :tag "Prefix keys" prefix-keys)
                         (const :tag "Simulation keys" simulation-keys)
+                        (const :tag "Workspace" workspace)
                         ;; For forward compatibility.
                         (other))
                        :value-type (sexp :tag "Value" nil))))
@@ -202,7 +203,6 @@ You can still make the X windows floating afterwards."
       (exwm--update-hints id)
       (exwm-manage--update-geometry id)
       (exwm-manage--update-mwm-hints id)
-      (setq exwm--configurations (exwm-manage--get-configurations))
       ;; No need to manage (please check OverrideRedirect outside)
       (when (or
              (not
@@ -266,6 +266,10 @@ You can still make the X windows floating afterwards."
         (let ((kill-buffer-query-functions nil))
           (kill-buffer (current-buffer)))
         (throw 'return 'ignored))
+      (setq exwm--configurations (exwm-manage--get-configurations))
+      (let ((index (plist-get exwm--configurations 'workspace)))
+        (when (and index (< index (length exwm-workspace--list)))
+          (setq exwm--frame (elt exwm-workspace--list index))))
       ;; Manage the window
       (exwm--log "Manage #x%x" id)
       (xcb:+request exwm--connection    ;remove border
@@ -290,7 +294,8 @@ You can still make the X windows floating afterwards."
           ;; User has specified whether it should be floating.
           (if (plist-get exwm--configurations 'floating)
               (exwm-floating--set-floating id)
-            (exwm-floating--unset-floating id))
+            (with-selected-window (frame-selected-window exwm--frame)
+              (exwm-floating--unset-floating id)))
         ;; Try to determine if it should be floating.
         (if (and (not exwm-manage-force-tiling)
                  (or exwm-transient-for exwm--fixed-size
@@ -299,7 +304,8 @@ You can still make the X windows floating afterwards."
                      (memq xcb:Atom:_NET_WM_WINDOW_TYPE_DIALOG
                            exwm-window-type)))
             (exwm-floating--set-floating id)
-          (exwm-floating--unset-floating id)))
+          (with-selected-window (frame-selected-window exwm--frame)
+            (exwm-floating--unset-floating id))))
       (if (plist-get exwm--configurations 'char-mode)
           (exwm-input-release-keyboard id)
         (exwm-input-grab-keyboard id))