about summary refs log tree commit diff
path: root/exwm-layout.el
diff options
context:
space:
mode:
Diffstat (limited to 'exwm-layout.el')
-rw-r--r--exwm-layout.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/exwm-layout.el b/exwm-layout.el
index 9cbdd2b83d30..0069767d1a73 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -528,6 +528,8 @@ See also `exwm-layout-enlarge-window'."
         (exwm-layout-hide-mode-line)
       (exwm-layout-show-mode-line))))
 
+(defvar exwm-layout--timer nil "Timer used to track echo area changes.")
+
 (defun exwm-layout--init ()
   "Initialize layout module."
   ;; Auto refresh layout
@@ -535,9 +537,19 @@ See also `exwm-layout-enlarge-window'."
   (unless (exwm-workspace--minibuffer-own-frame-p)
     ;; Refresh when minibuffer grows
     (add-hook 'minibuffer-setup-hook #'exwm-layout--on-minibuffer-setup t)
-    (run-with-idle-timer 0 t #'exwm-layout--on-echo-area-change t)
+    (setq exwm-layout--timer
+          (run-with-idle-timer 0 t #'exwm-layout--on-echo-area-change t))
     (add-hook 'echo-area-clear-hook #'exwm-layout--on-echo-area-change)))
 
+(defun exwm-layout--exit ()
+  "Exit the layout module."
+  (remove-hook 'window-configuration-change-hook #'exwm-layout--refresh)
+  (remove-hook 'minibuffer-setup-hook #'exwm-layout--on-minibuffer-setup)
+  (when exwm-layout--timer
+    (cancel-timer exwm-layout--timer)
+    (setq exwm-layout--timer nil))
+  (remove-hook 'echo-area-clear-hook #'exwm-layout--on-echo-area-change))
+
 
 
 (provide 'exwm-layout)