fix: spawned clients were attaching to the host wayland display
another late night. testwm was launching terminals on the host compositor because WAYLAND_DISPLAY was never pointed at our own socket. set it before execlp. fixed, barely.
This commit is contained in:
@@ -50,6 +50,7 @@ struct Server {
|
||||
struct wlr_keyboard* keyboard = nullptr;
|
||||
wlr::SignalSink key_sink;
|
||||
wl_event_source* scheduler_source = nullptr;
|
||||
const char* socket_name = nullptr;
|
||||
|
||||
uint32_t mod = WLR_MODIFIER_ALT;
|
||||
std::string terminal = "kitty";
|
||||
@@ -123,6 +124,8 @@ static void cycle_focus(int dir) {
|
||||
static void spawn() {
|
||||
pid_t p = fork();
|
||||
if (p == 0) {
|
||||
if (S->socket_name)
|
||||
setenv("WAYLAND_DISPLAY", S->socket_name, 1);
|
||||
execlp(S->terminal.c_str(), S->terminal.c_str(), nullptr);
|
||||
_exit(127);
|
||||
}
|
||||
@@ -329,6 +332,7 @@ int main() {
|
||||
S->scheduler_source = wl_event_loop_add_timer(S->display.event_loop(), frame_tick, nullptr);
|
||||
|
||||
const char* socket = S->display.add_socket_auto();
|
||||
S->socket_name = socket;
|
||||
if (!socket)
|
||||
return 1;
|
||||
fprintf(stderr,
|
||||
|
||||
Reference in New Issue
Block a user