about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2017-11-08T17·28+0800
committerChris Feng <chris.w.feng@gmail.com>2017-11-08T17·28+0800
commit21351f6be32d6867edbf887cfb12c5c9d73873c6 (patch)
treed7e914f51f4766c45bb6762f42364e894d9e11a3
parent088818fedbc7293a5d35e0a7962f4ebebf859b92 (diff)
Be more precise when choosing the init hook
* exwm.el (exwm-enable): Run `exwm-init' in
`after-make-frame-functions' only for emacsclient and
`window-setup-hook' only for ordinary sessions.
-rw-r--r--exwm.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/exwm.el b/exwm.el
index 8ef1fc4fe78e..fe1024676b76 100644
--- a/exwm.el
+++ b/exwm.el
@@ -726,8 +726,11 @@
      ;; Ignore unrecognized command line arguments.  This can be helpful
      ;; when EXWM is launched by some session manager.
      (push #'vector command-line-functions)
-     (add-hook 'window-setup-hook #'exwm-init t)          ;for Emacs
-     (add-hook 'after-make-frame-functions #'exwm-init t) ;for Emacs Client
+     (if (display-graphic-p)
+         ;; emacs.
+         (add-hook 'window-setup-hook #'exwm-init t)
+       ;; emacsclient.
+       (add-hook 'after-make-frame-functions #'exwm-init t))
      (add-hook 'kill-emacs-hook #'exwm--server-stop)
      (dolist (i exwm-blocking-subrs)
        (advice-add i :around #'exwm--server-eval-at)))))