1Ensure that the correct `app_id` for Wayland is set. The upstream implementation
2uses `QFileInfo::baseName()`[1] which strips everything away after the first dot.
3This means that `.foo-wrapped` has an empty `app_id` because `baseName` returns
4an empty string in this case.
5
6The patch basically checks whether the program has the form `.foo-wrapped` (i.e. got
7wrapped by `makeWrapper`) and if that's the case, `foo` will be the correct `app_id`.
8
9[1] https://doc.qt.io/qt-5/qfileinfo.html#baseName
10
11diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
12index ba881cb..b3fd031 100644
13--- a/src/client/qwaylandwindow.cpp
14+++ b/src/client/qwaylandwindow.cpp
15@@ -167,7 +167,20 @@ void QWaylandWindow::initWindow()
16 Qt::SkipEmptyParts);
17
18 if (domainName.isEmpty()) {
19- mShellSurface->setAppId(fi.baseName());
20+ auto baseName = fi.baseName();
21+ if (baseName.isEmpty()) {
22+ auto fileName = fi.fileName();
23+ if (fileName.endsWith("-wrapped") && fileName.startsWith(".")) {
24+ do {
25+ auto len = fileName.length();
26+ fileName = fileName.right(len - 1);
27+ fileName = fileName.left(len - 9);
28+ } while (fileName.endsWith("-wrapped") && fileName.startsWith("."));
29+ mShellSurface->setAppId(fileName);
30+ }
31+ } else {
32+ mShellSurface->setAppId(baseName);
33+ }
34 } else {
35 QString appId;
36 for (int i = 0; i < domainName.count(); ++i)