I use sway compositor.
When I change user in console, I can NOT display a wayland graphic interface (It work with a X application)
$ su - otherUser
$ ./myApplicationWayland
error: XDG_RUNTIME_DIR not set in the environment
I set it: (get from the other user)
$ export XDG_RUNTIME_DIR=/run/user/1000
$ export WAYLAND_DISPLAY=wayland-0
$ ./myApplicationWayland
Assert ... It cannot create the "display"
In the main user:
$ ls -l /run/user/1000
total 0
srw-rw-rw- 1 edupin edupin 0 Jan 23 08:14 bus
drwx------ 2 edupin edupin 60 Jan 26 13:25 dconf
dr-x------ 2 edupin edupin 0 Jan 23 08:15 gvfs
drwx------ 2 edupin edupin 80 Jan 26 14:31 pulse
srwxr-xr-x 1 edupin edupin 0 Jan 23 08:14 sway-ipc.1000.645.sock
drwxr-xr-x 3 edupin edupin 100 Jan 23 08:14 systemd
srwxr-xr-x 1 edupin edupin 0 Jan 23 08:14 wayland-0
-rw-r----- 1 edupin edupin 0 Jan 23 08:14 wayland-0.lock
I do:
chmod -R g+rwx /run/user/1000
The wayland connection fail when I call:
wl_display_connect(nullptr);
Thank you