wl_display_connect(3) Connect to a Wayland socket

Other Alias



#include <wayland-client.h>

struct wl_display *wl_display_connect(const char *name);
struct wl_display *wl_display_connect_to_fd(int fd);



connects to a Wayland socket that was previously opened by a Wayland server. The server socket must be placed in XDG_RUNTIME_DIR for this function to find it. The name argument specifies the name of the socket or NULL to use the default (which is "wayland-0"). The environment variable WAYLAND_DISPLAY replaces the default value. If WAYLAND_SOCKET is set, this function behaves like wl_display_connect_to_fd with the file-descriptor number taken from the environment variable.

wl_display_connect_to_fd connects to a Wayland socket with an explicit file-descriptor. The file-descriptor is passed as argument fd.


wl_display_connect and wl_display_connect_to_fd return a new display context object or NULL on failure. errno is set correspondingly.