我使用摇摆合成器。
当我在控制台中更改用户时,我无法显示 wayland 图形界面(它与 X 应用程序一起使用)
$ su - otherUser
$ ./myApplicationWayland
error: XDG_RUNTIME_DIR not set in the environment
我设置它:(从其他用户那里获取)
$ export XDG_RUNTIME_DIR=/run/user/1000
$ export WAYLAND_DISPLAY=wayland-0
$ ./myApplicationWayland
Assert ... It cannot create the "display"
在主用户中:
$ 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
当我调用以下命令时,wayland 连接失败:
wl_display_connect(nullptr);
谢谢
这简直就是一个正确的问题。路径 /run/user/XXX 对于其他用户来说是不可访问的,那么其他用户就无法访问并获取“其他”权限可用的 wayland socker 事件上的点。
解决方案(不好但很快)(用用户 ID 替换 XXX):
在运行 sway 的用户上:
chmod -R 777 /run/user/XXXX
在第二个用户上:
export XDG_RUNTIME_DIR=/run/user/XXXX
另一种方式(更好,但也不是很好)
设置“users”组中的所有用户
在提供 wayland 合成器的用户中编辑“.bashrc”:
# specify a path to create the wayland IO and force it to be readable for each user in group "users"
export XDG_RUNTIME_DIR=/tmp/wayland
export WAYLAND_DISPLAY=wayland-0
# create default directory
mkdir -p $XDG_RUNTIME_DIR
chgrp users $XDG_RUNTIME_DIR
chmod g+rwx $XDG_RUNTIME_DIR
# at the first run of the terminal ==> the other user have acces on it (many time use terminal to change user)
chgrp users $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY
chmod g+rwx $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY
在所有其他用户中编辑“.bashrc”:
export XDG_RUNTIME_DIR=/tmp/wayland
export WAYLAND_DISPLAY=wayland-0
如果您希望所有应用程序默认启动 Wayland 中的所有后端:
# force all generic backend to use wayland backend
export GDK_BACKEND=wayland
export QT_QPA_PLATFORM=wayland-egl
export CLUTTER_BACKEND=wayland
export SDL_VIDEODRIVER=wayland
export EWOL_BACKEND=wayland
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)