Index: b/src/dispnew.c =================================================================== --- a/src/dispnew.c +++ b/src/dispnew.c @@ -6559,8 +6558,20 @@ init_display_interactive (void) #ifdef HAVE_PGTK if (!inhibit_window_system && !will_dump_p ()) { - Vinitial_window_system = Qpgtk; - return; + char *display, *wayland_display; + display = getenv ("DISPLAY"); + wayland_display = getenv ("WAYLAND_DISPLAY"); + + if (display == NULL && wayland_display == NULL) + { + fprintf (stderr, "Neither DISPLAY nor WAYLAND_DISPLAY are set, simulating -nw\n"); + inhibit_window_system = 1; + } + else + { + Vinitial_window_system = Qpgtk; + return; + } } #endif