(defun restarts-menu (err)
"Display a menu with the active restarts and let the user pick
@@ -222,10 +225,24 @@ such a case, kill the shell command to resume StumpWM."
(defcommand-alias abort keyboard-quit)
+(defun windows-query-on-exit ()
+ "t if no window exist or the user wants to exit anyway."
+ (or (null (all-windows))
+ (yes-or-no-p "Active windows exist; kill them and exit anyway? ")))
+(defvar *confirm-kill-stumpwm* nil
+ "If non-nil, predicate function to confirm killing StumpWM.
+Nil means to not ask.")
(defcommand quit () ()
- (throw :top-level :quit))
+ "Quit StumpWM.
+Use the variable `*confirm-kill-stumpwm*' to hold a predicate. This
+predicate evaluates to t when you want to quit."
+ (when (or (null *confirm-kill-stumpwm*)
+ (funcall *confirm-kill-stumpwm*))
+ (throw :top-level :quit)))
(defcommand restart-soft () ()
"Soft Restart StumpWM. The lisp process isn't restarted. Instead,