about summary refs log tree commit diff
path: root/exwm.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2019-03-10T00·00+0000
committerChris Feng <chris.w.feng@gmail.com>2019-03-10T00·00+0000
commitb12c67de2ed10e2528b1c494aa08d51b43e563dd (patch)
treef96b12b525dbc42df59c3a5ffc41cd8c5e42decb /exwm.el
parent88c690217aa165db301c47981b52fb7c6df75154 (diff)
Make replacing existing WM optional
* exwm.el (exwm-replace): New user option for specifying whether to
replace existing WM.
(exwm-init): Use it.
(exwm--wmsn-acquire, exwm-init): Do not print warning message when
user gives up replacing.
* exwm-core.el (exwm--wmsn-replace): Remove dead code.
Diffstat (limited to 'exwm.el')
-rw-r--r--exwm.el11
1 files changed, 9 insertions, 2 deletions
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