run Xwayland permissively instead of sharing the host Xauthority

This commit is contained in:
Andrew Hamilton 2026-08-22 11:34:40 +10:00
parent aab41f286e
commit 884167bbb6

17
kick.c
View file

@ -7297,6 +7297,13 @@ static int cmd_in_path(const char *cmd) {
return 0;
}
#if HAVE_XWAYLAND
/* Kick runs its own plain Xwayland (see the wlr_xwayland_create call site):
no -auth, so any local client connects without a magic cookie and nothing
is written to the session Xauthority. This is the normal wlroots default
and avoids the legacy X11 access-control dance entirely. */
#endif
static void launch_client(struct kick_app *app) {
pid_t pid = fork();
if (pid == 0) {
@ -7313,9 +7320,9 @@ static void launch_client(struct kick_app *app) {
our Xwayland. GDK/Qt stay on Wayland via the forced backends
above; SDL and friends prefer Wayland too, so DISPLAY only picks
up clients with no Wayland support. */
if (server.xwayland && server.xwayland->display_name)
if (server.xwayland && server.xwayland->display_name) {
setenv("DISPLAY", server.xwayland->display_name, 1);
else
} else
unsetenv("DISPLAY");
#else
unsetenv("DISPLAY");
@ -8005,6 +8012,12 @@ int main(int argc, char *argv[]) {
bridges ICCCM focus and X11 selections onto the seat, which rides the
existing clipboard bridge out to the host. */
if (!getenv("KICK_NO_XWAYLAND")) {
/* Run our own plain Xwayland: ignore any WLR_XWAYLAND wrapper the
environment may point at (e.g. one that forces `-auth` and the
legacy X11 cookie dance). wlroots then execs the compiled-in
Xwayland with no -auth, so local clients connect freely and we
never touch the session Xauthority file. */
unsetenv("WLR_XWAYLAND");
server.xwayland = wlr_xwayland_create(server.wl_display,
server.compositor, true);
if (server.xwayland) {