Skip to content

Commit bd57e31

Browse files
author
Yuuki Harano
committed
emacsclient should use both of DISPLAY and WAYLAND_DISPLAY.
1 parent ce4e7bb commit bd57e31

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

lib-src/emacsclient.c

+5
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,12 @@ decode_options (int argc, char **argv)
611611
alt_display = "w32";
612612
#endif
613613

614+
#ifdef HAVE_PGTK
615+
display = egetenv ("WAYLAND_DISPLAY");
616+
alt_display = egetenv ("DISPLAY");
617+
#else
614618
display = egetenv ("DISPLAY");
619+
#endif
615620
}
616621

617622
if (!display)

lisp/server.el

+19-14
Original file line numberDiff line numberDiff line change
@@ -896,20 +896,25 @@ This handles splitting the command if it would be bigger than
896896
;; emacsclient quits while also preventing
897897
;; `server-save-buffers-kill-terminal' from unexpectedly
898898
;; killing emacs on that frame.
899-
(let* ((params `((client . ,(if nowait 'nowait proc))
900-
;; This is a leftover, see above.
901-
(environment . ,(process-get proc 'env))
902-
,@parameters))
903-
frame)
904-
(if parent-id
905-
(push (cons 'parent-id (string-to-number parent-id)) params))
906-
(add-to-list 'frame-inherited-parameters 'client)
907-
(setq frame (make-frame-on-display display params))
908-
(server-log (format "%s created" frame) proc)
909-
(select-frame frame)
910-
(process-put proc 'frame frame)
911-
(process-put proc 'terminal (frame-terminal frame))
912-
frame))
899+
(condition-case x
900+
(let* ((params `((client . ,(if nowait 'nowait proc))
901+
;; This is a leftover, see above.
902+
(environment . ,(process-get proc 'env))
903+
,@parameters))
904+
frame)
905+
(if parent-id
906+
(push (cons 'parent-id (string-to-number parent-id)) params))
907+
(add-to-list 'frame-inherited-parameters 'client)
908+
(setq frame (make-frame-on-display display params))
909+
(server-log (format "%s created" frame) proc)
910+
(select-frame frame)
911+
(process-put proc 'frame frame)
912+
(process-put proc 'terminal (frame-terminal frame))
913+
frame)
914+
(error
915+
(server-log "Window system unsupported" proc)
916+
(server-send-string proc "-window-system-unsupported \n")
917+
nil)))
913918

914919
(t
915920
(server-log "Window system unsupported" proc)

0 commit comments

Comments
 (0)