From 9153c22dab77837f93c96edbf5acfbc4ffb3b0c8 Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Wed, 3 Jul 2024 13:43:04 -0400 Subject: [PATCH] xwayland: allow persistence Closes: #1958. --- docs/labwc-config.5.scd | 7 +++++++ docs/rc.xml.all | 1 + include/config/rcxml.h | 1 + src/config/rcxml.c | 2 ++ src/xwayland.c | 4 +++- 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/labwc-config.5.scd b/docs/labwc-config.5.scd index 85a8d437..f212ca0f 100644 --- a/docs/labwc-config.5.scd +++ b/docs/labwc-config.5.scd @@ -194,6 +194,13 @@ this is for compatibility with Openbox. be used with labwc the preferred mode of the monitor is used instead. Default is no. +** [yes|no] + Keep XWayland alive even when no clients are connected, rather than + using a "lazy" policy that allows the server to launch on demand and die + when it is no longer needed. Default is no. + + Note: changing this setting requires a restart of labwc. + ## PLACEMENT ** [center|automatic|cursor] diff --git a/docs/rc.xml.all b/docs/rc.xml.all index 35e5c91b..1f4a0f69 100644 --- a/docs/rc.xml.all +++ b/docs/rc.xml.all @@ -13,6 +13,7 @@ no no no + no diff --git a/include/config/rcxml.h b/include/config/rcxml.h index 8df7c9aa..a9e89589 100644 --- a/include/config/rcxml.h +++ b/include/config/rcxml.h @@ -55,6 +55,7 @@ struct rcxml { bool allow_tearing; bool reuse_output_mode; enum view_placement_policy placement_policy; + bool xwayland_persistence; /* focus */ bool focus_follow_mouse; diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 0ff52bf3..d263cb9d 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -899,6 +899,8 @@ entry(xmlNode *node, char *nodename, char *content) if (rc.placement_policy == LAB_PLACE_INVALID) { rc.placement_policy = LAB_PLACE_CENTER; } + } else if (!strcasecmp(nodename, "xwaylandPersistence.core")) { + set_bool(content, &rc.xwayland_persistence); } else if (!strcmp(nodename, "name.theme")) { rc.theme_name = xstrdup(content); } else if (!strcmp(nodename, "cornerradius.theme")) { diff --git a/src/xwayland.c b/src/xwayland.c index d4eff83d..72eaa7cf 100644 --- a/src/xwayland.c +++ b/src/xwayland.c @@ -6,6 +6,7 @@ #include "common/array.h" #include "common/macros.h" #include "common/mem.h" +#include "config/rcxml.h" #include "labwc.h" #include "node.h" #include "ssd.h" @@ -1052,7 +1053,8 @@ void xwayland_server_init(struct server *server, struct wlr_compositor *compositor) { server->xwayland = - wlr_xwayland_create(server->wl_display, compositor, true); + wlr_xwayland_create(server->wl_display, + compositor, /* lazy */ !rc.xwayland_persistence); if (!server->xwayland) { wlr_log(WLR_ERROR, "cannot create xwayland server"); exit(EXIT_FAILURE); -- 2.52.0