There are two ways for programs to connect to the Wayland compositor: typically, the environment variable WAYLAND_DISPLAY is set, in which case it specifies a socket file to connect to; but sometimes compositors may provide the environment variable WAYLAND_SOCKET to specify a file descriptor for an already-connected socket (which was inherited from the parent process). (Note: the main Wayland documentation only mentions WAYLAND_DISPLAY; WAYLAND_SOCKET is mentioned in wl_display_connect()'s description.)
mpv currently only detects the Wayland compositor by whether WAYLAND_DISPLAY is available; this feature request is to also try to connect to a Wayland compositor if WAYLAND_SOCKET is set.
WAYLAND_SOCKET is sometimes used by compositors when running specific programs like taskbars, and some of the programs I've made (like https://gitlab.freedesktop.org/mstoeckl/windowtolayer) set it when running just a single Wayland application. It does not see much use otherwise, so I'd consider this more of a feature request than a bug.
Alternative behavior of the wanted feature
No response
Log File
I've attached a script to run an application under WAYLAND_SOCKET instead of WAYLAND_DISPLAY. It also unsets DISPLAY to prevent an X11 connection. wldisplaytosocket.py.txt
Under a Wayland compositor, with Xwayland turned off, running mpv path/to/video_file works fine; but wldisplaytosocket.py mpv path/to/video.h264 fails to detect Wayland availability and uses the drm backend, which fails. I've attached the resulting log file in case it's useful: output.txt
Expected behavior of the wanted feature
There are two ways for programs to connect to the Wayland compositor: typically, the environment variable WAYLAND_DISPLAY is set, in which case it specifies a socket file to connect to; but sometimes compositors may provide the environment variable WAYLAND_SOCKET to specify a file descriptor for an already-connected socket (which was inherited from the parent process). (Note: the main Wayland documentation only mentions WAYLAND_DISPLAY; WAYLAND_SOCKET is mentioned in
wl_display_connect()
's description.)mpv currently only detects the Wayland compositor by whether WAYLAND_DISPLAY is available; this feature request is to also try to connect to a Wayland compositor if WAYLAND_SOCKET is set.
WAYLAND_SOCKET is sometimes used by compositors when running specific programs like taskbars, and some of the programs I've made (like https://gitlab.freedesktop.org/mstoeckl/windowtolayer) set it when running just a single Wayland application. It does not see much use otherwise, so I'd consider this more of a feature request than a bug.
Alternative behavior of the wanted feature
No response
Log File
I've attached a script to run an application under WAYLAND_SOCKET instead of WAYLAND_DISPLAY. It also unsets DISPLAY to prevent an X11 connection. wldisplaytosocket.py.txt
Under a Wayland compositor, with Xwayland turned off, running
mpv path/to/video_file
works fine; butwldisplaytosocket.py mpv path/to/video.h264
fails to detect Wayland availability and uses the drm backend, which fails. I've attached the resulting log file in case it's useful: output.txtSample Files
No response