From ddd4eb5b0c51a6761179b8def628d1cd9a13599f Mon Sep 17 00:00:00 2001 From: Jeremy Borgman Date: Fri, 5 Feb 2021 19:25:48 -0600 Subject: [PATCH] added wayland XCB hack for clipboard --- src/main.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 21fae96e..9d775c59 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -51,9 +51,24 @@ int waitAfterConnecting(int delay, QCoreApplication& app) return app.exec(); } +// source: https://github.com/ksnip/ksnip/issues/416 +void wayland_hacks() +{ + // Workaround to https://github.com/ksnip/ksnip/issues/416 + QByteArray currentDesktop = qgetenv("XDG_CURRENT_DESKTOP").toLower(); + QByteArray sessionDesktop = qgetenv("XDG_SESSION_DESKTOP").toLower(); + QByteArray sessionType = qgetenv("XDG_SESSION_TYPE").toLower(); + if (sessionType.contains("wayland") && (currentDesktop.contains("gnome") || + sessionDesktop.contains("gnome"))) { + qputenv("QT_QPA_PLATFORM", "xcb"); + } +} + int main(int argc, char* argv[]) { - +#ifdef Q_OS_LINUX + wayland_hacks(); +#endif spdlog::set_level(spdlog::level::debug); // Set global log level to debug spdlog::set_pattern("[source %s] [function %!] [line %#] %v");