Skip to content

Commit 3722ddf

Browse files
authored
Support unix-based X11 server connections as well as TCP-based ones
Typically, on unix systems, local X11 is connected through the socket `/tmp/.X11-unix/X0`, as indicated by the missing host name part in `DISPLAY=:0` or `DISPLAY=:0.0`. WSLg (the X11 implementation provided with WSL in Microsoft Windows) does not listen on the TCP socket localhost:6000, but on the Unix socket only. So this commit enables SSH X11 forwarding to connect to the unix domain socket if the X server host name is set to the empty string.
1 parent eb9f5e4 commit 3722ddf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/backend/mi2/mi2.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,10 @@ export class MI2 extends EventEmitter implements IBackend {
155155
const xclientsock = accept();
156156
xclientsock.pipe(xserversock).pipe(xclientsock);
157157
});
158-
xserversock.connect(args.x11port, args.x11host);
158+
if (args.x11host !== "")
159+
xserversock.connect(args.x11port, args.x11host);
160+
else
161+
xserversock.connect(`/tmp/.X11-unix/X${args.x11port}`)
159162
});
160163
}
161164

0 commit comments

Comments
 (0)