about summary refs log tree commit diff
path: root/exwm-randr.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2018-02-21T16·31+0800
committerChris Feng <chris.w.feng@gmail.com>2018-02-21T16·31+0800
commit32b88f4bd0274e8ee1d4215ed52ee6d3c460c013 (patch)
tree39d26f2681eff3952c945ef9570cb69701f33f29 /exwm-randr.el
parent6200417697544317ee91badd702654def9a1d645 (diff)
Mark active workspaces on each output
* exwm-randr.el (exwm-randr--refresh): Mark active workspaces.
* exwm-workspace.el (exwm-workspace-switch): Use the marks to
show/hide X windows when switching workspace; do not update timestamp.
(exwm-workspace-move-window): Use the marks to hide X windows after
moving them.
(exwm-workspace--init): Update `frameset-filter-alist'.
Diffstat (limited to 'exwm-randr.el')
-rw-r--r--exwm-randr.el23
1 files changed, 21 insertions, 2 deletions
diff --git a/exwm-randr.el b/exwm-randr.el
index 39edb7b1b9be..c78a4ec812aa 100644
--- a/exwm-randr.el
+++ b/exwm-randr.el
@@ -89,7 +89,8 @@ the first one in result being the primary output."
 
 (defun exwm-randr--refresh ()
   "Refresh workspaces according to the updated RandR info."
-  (let (output-name geometry output-plist primary-output default-geometry)
+  (let (output-name geometry output-plist primary-output default-geometry
+                    container-output-alist container-frame-alist)
     ;; Query all outputs
     (with-slots (config-timestamp outputs)
         (xcb:+request-unchecked+reply exwm--connection
@@ -126,12 +127,30 @@ the first one in result being the primary output."
       (dotimes (i (exwm-workspace--count))
         (let* ((output (plist-get exwm-randr-workspace-output-plist i))
                (geometry (lax-plist-get output-plist output))
-               (frame (elt exwm-workspace--list i)))
+               (frame (elt exwm-workspace--list i))
+               (container (frame-parameter frame 'exwm-container)))
           (unless geometry
             (setq geometry default-geometry
                   output primary-output))
+          (setq container-output-alist (nconc `((,container . ,output))
+                                              container-output-alist)
+                container-frame-alist (nconc `((,container . ,frame))
+                                             container-frame-alist))
           (set-frame-parameter frame 'exwm-randr-output output)
           (set-frame-parameter frame 'exwm-geometry geometry)))
+      ;; Update the 'exwm-active' frame parameter.
+      (dolist (xwin
+               (reverse
+                (slot-value (xcb:+request-unchecked+reply exwm--connection
+                                (make-instance 'xcb:QueryTree
+                                               :window exwm--root))
+                            'children)))
+        (let ((output (cdr (assq xwin container-output-alist))))
+          (when output
+            (setq container-output-alist
+                  (rassq-delete-all output container-output-alist))
+            (set-frame-parameter (cdr (assq xwin container-frame-alist))
+                                 'exwm-active t))))
       ;; Update workareas.
       (exwm-workspace--update-workareas)
       ;; Resize workspace.