From 919ac3d7184faee0ccfa7fe65c6635a7dcf5d234 Mon Sep 17 00:00:00 2001
Message-Id: <919ac3d7184faee0ccfa7fe65c6635a7dcf5d234.1553291431.git.jan.steffens@gmail.com>
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Fri, 22 Mar 2019 22:37:22 +0100
Subject: [PATCH] qtui: Set desktop file name

The XCB platform plugin defaults the WM class to the executable name,
which already matches our desktop file name. Unfortunately, the Wayland
platform plugin prepends the inverted organization domain, resulting in
an app ID of "org.quassel-irc.quasselclient", thus breaking the
association.

Set the desktop file name explicitly so the Wayland platform doesn't get
confused.
---
 src/qtui/monoapplication.cpp | 3 +++
 src/qtui/qtuiapplication.cpp | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/qtui/monoapplication.cpp b/src/qtui/monoapplication.cpp
index 809f1147..3f60523f 100644
--- a/src/qtui/monoapplication.cpp
+++ b/src/qtui/monoapplication.cpp
@@ -32,6 +32,9 @@ MonolithicApplication::MonolithicApplication(int &argc, char **argv)
     : QtUiApplication(argc, argv)
 {
     Quassel::setRunMode(Quassel::Monolithic);
+#if QT_VERSION >= 0x050700
+    QGuiApplication::setDesktopFileName(Quassel::buildInfo().applicationName + ".desktop");
+#endif
 }
 
 
diff --git a/src/qtui/qtuiapplication.cpp b/src/qtui/qtuiapplication.cpp
index e5b0b773..989a1961 100644
--- a/src/qtui/qtuiapplication.cpp
+++ b/src/qtui/qtuiapplication.cpp
@@ -92,6 +92,9 @@ QtUiApplication::QtUiApplication(int &argc, char **argv)
 #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
     QGuiApplication::setFallbackSessionManagementEnabled(false);
 #endif
+#if QT_VERSION >= 0x050700
+    QGuiApplication::setDesktopFileName(Quassel::buildInfo().clientApplicationName + ".desktop");
+#endif
 }
 
 
-- 
2.21.0

