want a way to specify the entire pathname of the local domain socket
Submitted by Zack Weinberg
Assigned to Jeremy Huddleston Sequoia
Description
It would be nice to have a way to configure the entire pathname of the local domain socket that the X server is listening to, and of course the same for the socket that Xlib uses to connect to the server. My use case for this is Xvfb-based testing of GUI applications - currently I have to loop over values of /tmp/.X11-unix/X%d to find an available display number, and then race with other people doing the same thing on that host to get the server started.
Proposed ideal solution: On the server side, the existing -listen switch is extended to take an argument of the form local:/absolute/pathname; if that pathname references a directory with acceptable permissions, it creates the usual X%d socket in that directory (where %d is the display number as usual); if the last component of that pathname does not exist, it is created as a directory, go to part 1; otherwise server startup fails. On the client side, the DISPLAY variable is extended to take a value of the form local:/absolute/pathname:display.screen (where display and screen are numbers as usual, and may be omitted with the same semantics as currently). The /absolute/pathname replaces /tmp/.X11-unix when looking for the socket. Document that the path should not contain colons in either case.
In both cases, you should be able to use "unix" instead of "local". Also, libICE should use /absolute/pathname (or possibly /absolute/pathname/ICE, creating that subdirectory if necessary) instead of /tmp/.ICE-unix if it finds DISPLAY to have this form.
If this is not doable for whatever reason, a less ideal but still acceptable option would be to honor the TMPDIR environment variable, on both client and server, when looking for the .X11-unix and .ICE-unix directories. If this is done, client obviously should fall back to /tmp if there is no socket in $TMPDIR/.X11-unix.