about summary refs log tree commit diff
path: root/exwm-floating.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2015-08-16T11·00+0800
committerChris Feng <chris.w.feng@gmail.com>2015-08-16T11·02+0800
commitd998b42b89bc9e248b6d2250c56ddd17ec4b17cf (patch)
tree3d0c6ff68b04c46a8ee58b51ac0f615b929987d4 /exwm-floating.el
parent7bfd429d5252e8df43d1b19b836a6c4970290fa0 (diff)
Provide hooks run when the floating state of a window changes (close #28)
Diffstat (limited to 'exwm-floating.el')
-rw-r--r--exwm-floating.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/exwm-floating.el b/exwm-floating.el
index 06d6fa505c88..bc6b1a246a54 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -36,6 +36,11 @@
 (defvar exwm-floating-border-color "blue"
   "Border color of the floating window.")
 
+(defvar exwm-floating-setup-hook nil
+  "Normal hook run when a window has been made floating.")
+(defvar exwm-floating-exit-hook nil
+  "Normal hook run when a window has exited floating state.")
+
 (defun exwm-floating--set-floating (id)
   "Make window ID floating."
   (interactive)
@@ -180,7 +185,8 @@
             exwm--floating-frame frame)
       (set-window-buffer window (current-buffer)) ;this changes current buffer
       (set-window-dedicated-p window t))
-    (select-window window)))
+    (select-window window))
+  (run-hooks 'exwm-floating-setup-hook))
 
 (defun exwm-floating--unset-floating (id)
   "Make window ID non-floating."
@@ -213,7 +219,8 @@
             exwm--frame exwm-workspace--current))
     (let ((window (frame-selected-window exwm-workspace--current)))
       (set-window-buffer window buffer)
-      (select-window window))))
+      (select-window window)))
+  (run-hooks 'exwm-floating-exit-hook))
 
 (defun exwm-floating-toggle-floating ()
   "Toggle the current window between floating and non-floating states."