From e61a1aa6c7b27242fc1d03401b4240c6f58ac311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net> Date: Thu, 15 Jun 2023 18:32:56 -0400 Subject: [PATCH] Use XDG_ENVIRONMENT_TYPE to switch to CLIPBOARD It appears that XDG_ENVIRONMENT_TYPE will always equal "wayland" when XWayland is in use, so when we see that, switch to CLIPBOARD instead of PRIMARY. This should fix WSL and ChromeOS, and be irritating on GNOME, so it's a win all around. --- src/conio/x_events.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/conio/x_events.c b/src/conio/x_events.c index 6c209ae076..77239ff1a6 100644 --- a/src/conio/x_events.c +++ b/src/conio/x_events.c @@ -327,6 +327,7 @@ initialize_atoms(void) Atom atom; struct AtomDef *ad; long offset; + const char *evar; supported_standards |= (1 << UTF8_ATOM); supported_standards |= (1 << ICCCM_ATOM); @@ -424,10 +425,15 @@ initialize_atoms(void) } /* - * ChromeOS doesn't do anything reasonable with PRIMARY... - * Hack in use of CLIPBOARD instead. + * Wayland sucks, use CLIPBOARD instead of PRIMARY + * This will annoy users in Wayland environments where + * PRIMARY is properly supported (apparently GNOME) + * but GNOME is why I'm not writing a Wayland bakend + * right now anyway (no server-side decorations) so + * they can suck it. */ - if (wm_wm_name != NULL && strcmp(wm_wm_name, "Sommelier") == 0) { + evar = getenv("XDG_SESSION_TYPE"); + if (evar && strcmp(evar, "wayland")) { if (A(CLIPBOARD) != None) copy_paste_selection = A(CLIPBOARD); } -- GitLab