linux Wayland 显示多用户 [英] linux Wayland display multiple-user
问题描述
我使用摇摆合成器.
当我在控制台更改用户时,我无法显示 Wayland 图形界面(它适用于 X 应用程序)
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"
在主用户中:
$ 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
我愿意:
chmod -R g+rwx /run/user/1000
我调用时wayland连接失败:
The wayland connection fail when I call:
wl_display_connect(nullptr);
谢谢
推荐答案
这只是一个正确的问题.路径/run/user/XXX是其他用户无法访问的,那么其他用户就无法访问并获得other"权限的wayland socker事件的点数.
This is simply a right problem. The path /run/user/XXX is not accessible for other user, then the other user can not access and get point on the wayland socker event of the "other" right is availlable.
解决方案(不好但很快)(用用户ID替换XXX):
The solution (bad way but fast) (replace XXX with the user ID):
关于摇摆不定的用户:
chmod -R 777 /run/user/XXXX
在第二个用户上:
export XDG_RUNTIME_DIR=/run/user/XXXX
<小时>
另一种方式(更好,但也不是很好)
An other way (better, but not very good too)
设置users"组中的所有用户
Set all the user in the group "users"
在提供 wayland 合成器的用户中编辑.bashrc":
In the user that provided the wayland compositor edit ".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":
In all other user edit ".bashrc":
export XDG_RUNTIME_DIR=/tmp/wayland
export WAYLAND_DISPLAY=wayland-0
<小时>
如果您希望所有应用程序默认启动所有后端在wayland:
If you want all your application start by default all backend in 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
这篇关于linux Wayland 显示多用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!