about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--exwm-core.el3
-rw-r--r--exwm.el11
2 files changed, 9 insertions, 5 deletions
diff --git a/exwm-core.el b/exwm-core.el
index 9b6877b83f..55fbecdddd 100644
--- a/exwm-core.el
+++ b/exwm-core.el
@@ -41,9 +41,6 @@
 (defvar exwm--wmsn-acquire-timeout 3
   "Number of seconds to wait for other window managers to release the selection.")
 
-(defvar exwm--wmsn-replace 'ask
-  "Replace existing window manager.")
-
 (defvar exwm--guide-window nil
   "An X window separating workspaces and X windows.")
 
diff --git a/exwm.el b/exwm.el
index fca8b5d7e8..7d301ab4bd 100644
--- a/exwm.el
+++ b/exwm.el
@@ -99,6 +99,12 @@
   "Subrs (primitives) that would normally block EXWM."
   :type '(repeat function))
 
+(defcustom exwm-replace 'ask
+  "Whether to replace existing window manager."
+  :type '(radio (const :tag "Ask" ask)
+                (const :tag "Replace by default" t)
+                (const :tag "Do not replace" nil)))
+
 (defconst exwm--server-name "server-exwm"
   "Name of the subordinate Emacs server.")
 
@@ -721,7 +727,7 @@ manager.  If t, replace it, if nil, abort and ask the user if `ask'."
       (when (eq replace 'ask)
         (setq replace (yes-or-no-p "Replace existing window manager? ")))
       (when (not replace)
-        (error "Other window manager detected")))
+        (user-error "Other window manager detected")))
     (let ((new-owner (xcb:generate-id exwm--connection)))
       (xcb:+request exwm--connection
           (make-instance 'xcb:CreateWindow
@@ -812,7 +818,7 @@ manager.  If t, replace it, if nil, abort and ask the user if `ask'."
         (xcb:icccm:init exwm--connection t)
         (xcb:ewmh:init exwm--connection t)
         ;; Try to register window manager selection.
-        (exwm--wmsn-acquire 'ask)
+        (exwm--wmsn-acquire exwm-replace)
         (when (xcb:+request-checked+request-check exwm--connection
                   (make-instance 'xcb:ChangeWindowAttributes
                                  :window exwm--root
@@ -836,6 +842,7 @@ manager.  If t, replace it, if nil, abort and ask the user if `ask'."
         (run-hooks 'exwm-init-hook)
         ;; Manage existing windows
         (exwm-manage--scan))
+    (user-error)
     ((quit error)
      (exwm-exit)
      ;; Rethrow error