diff options
Diffstat (limited to 'src/client/qwaylandwindow.cpp')
-rw-r--r-- | src/client/qwaylandwindow.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index ca0fa5139..83c44c25d 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -107,10 +107,24 @@ QWaylandWindow::QWaylandWindow(QWindow *window) // Set initial surface title mShellSurface->setTitle(window->title()); - // Set surface class to the .desktop file name (obtained from executable name) - QFileInfo exeFileInfo(qApp->applicationFilePath()); - QString className = exeFileInfo.baseName() + QLatin1String(".desktop"); - mShellSurface->setAppId(className); + // The appId is the desktop entry identifier that should follow the + // reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html), + // use the application domain if available, otherwise the executable base name. + // According to xdg-shell the appId is only the name, without the .desktop suffix. + QFileInfo fi = QCoreApplication::instance()->applicationFilePath(); + QStringList domainName = + QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'), + QString::SkipEmptyParts); + + if (domainName.isEmpty()) { + mShellSurface->setAppId(fi.baseName()); + } else { + QString appId; + for (int i = 0; i < domainName.count(); ++i) + appId.prepend(QLatin1Char('.')).prepend(domainName.at(i)); + appId.append(fi.baseName()); + mShellSurface->setAppId(appId); + } } if (QPlatformWindow::parent() && mSubSurfaceWindow) { |