Client: Don't sanitize desktop file name

This doesn't work well if the app id ends with ".desktop".

Pick-to: 6.5
Change-Id: I33d7c92f87595251f0da90277d12b2a2bb286a30
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Vlad Zahorodnii 2023-05-15 12:30:26 +03:00
parent 36ea56dae8
commit 5b2524c57d

View File

@ -153,19 +153,15 @@ void QWaylandWindow::initWindow()
setWindowTitle(window()->title());
// 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).
// According to xdg-shell the appId is only the name, without
// the .desktop suffix.
// reverse DNS convention (see
// http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html). According
// to xdg-shell the appId is only the name, without the .desktop suffix.
//
// If the application specifies the desktop file name use that
// removing the ".desktop" suffix, otherwise fall back to the
// executable name and prepend the reversed organization domain
// when available.
// If the application specifies the desktop file name use that,
// otherwise fall back to the executable name and prepend the
// reversed organization domain when available.
if (!QGuiApplication::desktopFileName().isEmpty()) {
QString name = QGuiApplication::desktopFileName();
if (name.endsWith(QLatin1String(".desktop")))
name.chop(8);
mShellSurface->setAppId(name);
mShellSurface->setAppId(QGuiApplication::desktopFileName());
} else {
QFileInfo fi = QFileInfo(QCoreApplication::instance()->applicationFilePath());
QStringList domainName =