From 05f96d5087cd0e242b020f4347dd309a20540c11 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 3059e4be..d617c1f9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -28,8 +28,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.33.1