about summary refs log tree commit diff
path: root/exwm-core.el
diff options
context:
space:
mode:
Diffstat (limited to 'exwm-core.el')
-rw-r--r--exwm-core.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/exwm-core.el b/exwm-core.el
index 750f134d1e..146594da0a 100644
--- a/exwm-core.el
+++ b/exwm-core.el
@@ -75,6 +75,15 @@
                                            xcb:EventMask:StructureNotify))))
   (xcb:flush exwm--connection))
 
+(defmacro exwm--defer (secs function &rest args)
+  "Defer the action until SECS seconds later.
+
+The action is to call FUNCTION with arguments ARGS."
+  `(run-with-idle-timer (time-add (or (current-idle-time) 0) ,secs)
+                        nil
+                        ,function
+                        ,@args))
+
 (defconst exwm--client-event-mask
   (eval-when-compile
     (logior xcb:EventMask:StructureNotify xcb:EventMask:PropertyChange))