diff --git a/hw/xwayland/man/Xwayland.man b/hw/xwayland/man/Xwayland.man index ef2db0e85..c12e9a840 100644 --- a/hw/xwayland/man/Xwayland.man +++ b/hw/xwayland/man/Xwayland.man @@ -65,6 +65,13 @@ option with Xwayland. This option has no effect if the compositor doesn't support the relevant XDG portal or if Xwayland was not compiled with EI and OEFFIS support. .TP 8 +.B \-enable-clipboard +Enable the Xwayland clipboard selection bridge in rootful mode, syncing +the X11 CLIPBOARD and PRIMARY selections with the Wayland clipboard and +primary selection. + +This option is not compatible with rootless mode (\fI-rootless\fP). +.TP 8 .B \-fullscreen Set the Xwayland window fullscreen when running rootful. diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c index c81633855..e5267acc3 100644 --- a/hw/xwayland/xwayland-screen.c +++ b/hw/xwayland/xwayland-screen.c @@ -992,6 +992,9 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv) ErrorF("This build does not have XDG portal support\n"); #endif } + else if (strcmp(argv[i], "-enable-clipboard") == 0) { + xwl_screen->enable_clipboard = 1; + } else if (strcmp(argv[i], "-nokeymap") == 0) { xwl_screen->nokeymap = 1; } @@ -1077,6 +1080,11 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv) return FALSE; } + if (xwl_screen->rootless && xwl_screen->enable_clipboard) { + ErrorF("error, cannot use the clipboard selection bridge when running rootless\n"); + return FALSE; + } + if (!xwl_screen->rootless && !xwl_screen->xdg_wm_base) { ErrorF("missing XDG-WM-Base protocol\n"); return FALSE; diff --git a/hw/xwayland/xwayland-screen.h b/hw/xwayland/xwayland-screen.h index 6927c40d5..14e680c65 100644 --- a/hw/xwayland/xwayland-screen.h +++ b/hw/xwayland/xwayland-screen.h @@ -66,6 +66,7 @@ struct xwl_screen { int has_grab; int decorate; int enable_ei_portal; + int enable_clipboard; int nokeymap; int hidpi; diff --git a/hw/xwayland/xwayland-selection.c b/hw/xwayland/xwayland-selection.c index fdb3c091e..33152e0b8 100644 --- a/hw/xwayland/xwayland-selection.c +++ b/hw/xwayland/xwayland-selection.c @@ -1111,6 +1111,9 @@ xwl_selection_init(struct xwl_seat *xwl_seat) if (xwl_screen->rootless) return; + if (!xwl_screen->enable_clipboard) + return; + if (xwl_screen->selection_bridge) return; diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c index 91c94681b..d4c9b92b6 100644 --- a/hw/xwayland/xwayland.c +++ b/hw/xwayland/xwayland.c @@ -119,6 +119,7 @@ ddxUseMsg(void) #ifdef XWL_HAS_EI_PORTAL ErrorF("-enable-ei-portal use the XDG portal for input emulation\n"); #endif + ErrorF("-enable-clipboard enable Xwayland clipboard selection bridge\n"); } static int init_fd = -1; @@ -247,6 +248,9 @@ ddxProcessArgument(int argc, char *argv[], int i) else if (strcmp(argv[i], "-enable-ei-portal") == 0) { return 1; } + else if (strcmp(argv[i], "-enable-clipboard") == 0) { + return 1; + } else if (strcmp(argv[i], "-output") == 0) { CHECK_FOR_REQUIRED_ARGUMENTS(1); return 2;