From fabeb2e9ef2ea162fca820647e3b166c0e63c5e6 Mon Sep 17 00:00:00 2001
From: Vitaly Zaitsev <vitaly@easycoding.org>
Date: Mon, 15 Feb 2021 14:59:31 +0100
Subject: [PATCH] Added a workaround to Wayland issues.
Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>
---
src/main.cpp | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/main.cpp b/src/main.cpp
index 60f34fe1..c84ad042 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -26,8 +26,25 @@
#include "src/bootstrapper/BootstrapperFactory.h"
#include "src/logging/LogOutputHandler.h"
+#ifdef Q_OS_LINUX
+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");
+ }
+}
+#endif
+
int main(int argc, char** argv)
{
+#ifdef Q_OS_LINUX
+ wayland_hacks();
+#endif
qInstallMessageHandler(LogOutputHandler::handleOutput);
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
--
2.35.3