about summary refs log tree commit diff
path: root/exwm-randr.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2016-07-19T03·01+0800
committerChris Feng <chris.w.feng@gmail.com>2016-07-19T03·01+0800
commitb409d873b6d1372dd7ba01155f7a03fb8de6e053 (patch)
tree35fe2782e1c77ca7d5c1f5110d7dee920e143ba9 /exwm-randr.el
parentc22f35620f0db3e86f4b0678a29dc3eee48df4d9 (diff)
parentb51f3e65f15385da70b659ef093230913429572b (diff)
Merge branch 'medranocalvo/dynamic-workspaces' into externals/exwm
Diffstat (limited to 'exwm-randr.el')
-rw-r--r--exwm-randr.el12
1 files changed, 7 insertions, 5 deletions
diff --git a/exwm-randr.el b/exwm-randr.el
index 85daff245d19..709469a44d0a 100644
--- a/exwm-randr.el
+++ b/exwm-randr.el
@@ -55,11 +55,11 @@
   "Normal hook run when the RandR module just refreshed.")
 
 (defvar exwm-workspace--fullscreen-frame-count)
-(defvar exwm-workspace-number)
 (defvar exwm-workspace--list)
 
-(declare-function exwm-workspace--update-workareas "exwm-workspace.el" ())
+(declare-function exwm-workspace--count "exwm-workspace.el")
 (declare-function exwm-workspace--set-fullscreen "exwm-workspace.el" (frame))
+(declare-function exwm-workspace--update-workareas "exwm-workspace.el" ())
 (declare-function exwm-workspace--set-desktop-geometry "exwm-workspace.el" ())
 
 (defun exwm-randr--refresh ()
@@ -97,7 +97,7 @@
       (when exwm-workspace--fullscreen-frame-count
         ;; Not all workspaces are fullscreen; reset this counter.
         (setq exwm-workspace--fullscreen-frame-count 0))
-      (dotimes (i exwm-workspace-number)
+      (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)))
@@ -154,10 +154,12 @@
                            ;;            xcb:randr:NotifyMask:OutputProperty
                            ;;            xcb:randr:NotifyMask:CrtcChange))
                            ))
-        (xcb:flush exwm--connection)))))
+        (xcb:flush exwm--connection)
+        (add-hook 'exwm-workspace-list-change-hook #'exwm-randr--refresh)))))
 
 (defun exwm-randr--exit ()
-  "Exit the RandR module.")
+  "Exit the RandR module."
+  (remove-hook 'exwm-workspace-list-change-hook #'exwm-randr--refresh))
 
 (defun exwm-randr-enable ()
   "Enable RandR support for EXWM."