diff --git a/abstract_client.cpp b/abstract_client.cpp index b7f7e99585..4597622439 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -546,6 +546,7 @@ void AbstractClient::setupWindowManagementInterface() w->setMinimizeable(isMinimizable()); w->setFullscreenable(isFullScreenable()); w->setThemedIconName(icon().name().isEmpty() ? QStringLiteral("xorg") : icon().name()); + w->setAppId(QString::fromUtf8(resourceName())); connect(this, &AbstractClient::captionChanged, w, [w, this] { w->setTitle(caption()); }); connect(this, &AbstractClient::desktopChanged, w, [w, this] { @@ -575,6 +576,11 @@ void AbstractClient::setupWindowManagementInterface() w->setThemedIconName(i.name().isEmpty() ? QStringLiteral("xorg") : i.name()); } ); + connect(this, &AbstractClient::windowClassChanged, w, + [w, this] { + w->setAppId(QString::fromUtf8(resourceName())); + } + ); connect(w, &PlasmaWindowInterface::closeRequested, this, [this] { closeWindow(); }); connect(w, &PlasmaWindowInterface::virtualDesktopRequested, this, [this] (quint32 desktop) { diff --git a/shell_client.cpp b/shell_client.cpp index b02fad7902..cf05398188 100644 --- a/shell_client.cpp +++ b/shell_client.cpp @@ -93,6 +93,13 @@ ShellClient::ShellClient(ShellSurfaceInterface *surface) // setup shadow integration getShadow(); connect(surface->surface(), &SurfaceInterface::shadowChanged, this, &Toplevel::getShadow); + + setResourceClass(surface->windowClass()); + connect(surface, &ShellSurfaceInterface::windowClassChanged, this, + [this] { + setResourceClass(m_shellSurface->windowClass()); + } + ); } ShellClient::~ShellClient() = default; diff --git a/toplevel.cpp b/toplevel.cpp index 43a3b30967..4740c8f873 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -226,8 +226,13 @@ Window Toplevel::wmClientLeader() const void Toplevel::getResourceClass() { - resource_name = QByteArray(info->windowClassName()).toLower(); - resource_class = QByteArray(info->windowClassClass()).toLower(); + setResourceClass(QByteArray(info->windowClassName()).toLower(), QByteArray(info->windowClassClass()).toLower()); +} + +void Toplevel::setResourceClass(const QByteArray &name, const QByteArray &className) +{ + resource_name = name; + resource_class = className; emit windowClassChanged(); } diff --git a/toplevel.h b/toplevel.h index 0e9afe94f5..eb46eb4f75 100644 --- a/toplevel.h +++ b/toplevel.h @@ -457,6 +457,7 @@ protected: void getWmOpaqueRegion(); void getResourceClass(); + void setResourceClass(const QByteArray &name, const QByteArray &className = QByteArray()); Xcb::Property fetchSkipCloseAnimation() const; void readSkipCloseAnimation(Xcb::Property &prop); void getSkipCloseAnimation();