mirror of
https://github.com/emacs-exwm/exwm.git
synced 2024-11-27 14:57:59 +01:00
Fix restarting issues
* exwm-workspace.el (exwm-workspace--confirm-kill-emacs): * exwm.el (exwm-restart): Run `kill-emacs-hook' early; do not check for X windows before restarting.
This commit is contained in:
parent
1e78045f95
commit
a3dba8edd9
2 changed files with 12 additions and 11 deletions
|
@ -1039,12 +1039,17 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
||||||
(declare-function exwm-manage--unmanage-window "exwm-manage.el")
|
(declare-function exwm-manage--unmanage-window "exwm-manage.el")
|
||||||
(declare-function exwm--exit "exwm.el")
|
(declare-function exwm--exit "exwm.el")
|
||||||
|
|
||||||
(defun exwm-workspace--confirm-kill-emacs (prompt)
|
(defun exwm-workspace--confirm-kill-emacs (prompt &optional force)
|
||||||
"Confirm before exiting Emacs."
|
"Confirm before exiting Emacs."
|
||||||
(when (pcase (length exwm--id-buffer-alist)
|
(when (or (and force (not (eq force 'no-check)))
|
||||||
(0 (y-or-n-p prompt))
|
(and (or (eq force 'no-check) (not exwm--id-buffer-alist))
|
||||||
(x (yes-or-no-p (format "[EXWM] %d window%s currently alive. %s"
|
(y-or-n-p prompt))
|
||||||
x (if (= x 1) "" "s") prompt))))
|
(yes-or-no-p (format "[EXWM] %d window(s) will be destroyed. %s"
|
||||||
|
(length exwm--id-buffer-alist) prompt)))
|
||||||
|
;; Run `kill-emacs-hook' before Emacs frames are unmapped so that
|
||||||
|
;; errors can be visible.
|
||||||
|
(run-hooks 'kill-emacs-hook)
|
||||||
|
(setq kill-emacs-hook nil)
|
||||||
;; Hide & reparent out all frames (save-set can't be used here since
|
;; Hide & reparent out all frames (save-set can't be used here since
|
||||||
;; X windows will be re-mapped).
|
;; X windows will be re-mapped).
|
||||||
(when (exwm-workspace--minibuffer-own-frame-p)
|
(when (exwm-workspace--minibuffer-own-frame-p)
|
||||||
|
|
8
exwm.el
8
exwm.el
|
@ -87,15 +87,11 @@
|
||||||
(defun exwm-restart ()
|
(defun exwm-restart ()
|
||||||
"Restart EXWM."
|
"Restart EXWM."
|
||||||
(interactive)
|
(interactive)
|
||||||
(when (exwm-workspace--confirm-kill-emacs "[EXWM] Restart? ")
|
(when (exwm-workspace--confirm-kill-emacs "[EXWM] Restart? " 'no-check)
|
||||||
(server-force-delete)
|
|
||||||
(run-hooks 'kill-emacs-hook)
|
|
||||||
;; FIXME: more?
|
|
||||||
(apply #'call-process (car command-line-args) nil nil nil
|
(apply #'call-process (car command-line-args) nil nil nil
|
||||||
(cdr command-line-args))
|
(cdr command-line-args))
|
||||||
;; Kill this instance at last.
|
;; Kill this instance at last.
|
||||||
(let ((kill-emacs-hook nil))
|
(kill-emacs)))
|
||||||
(kill-emacs))))
|
|
||||||
|
|
||||||
(defun exwm--update-window-type (id &optional force)
|
(defun exwm--update-window-type (id &optional force)
|
||||||
"Update _NET_WM_WINDOW_TYPE."
|
"Update _NET_WM_WINDOW_TYPE."
|
||||||
|
|
Loading…
Reference in a new issue