diff options
authorMartin Gräßlin <[email protected]>2016-10-11 16:32:47 +0200
committerMartin Gräßlin <[email protected]>2016-10-17 09:00:02 +0200
commit8201def97fcc1092461c7273dfe0766100ce7331 (patch)
parent9eede1c66b41dd06261036f4d0ccc933e50f7b6a (diff)
Set icon to wayland if desktop file is not found
Summary: For X windows KWin uses the generic X icon if no icon is found. Thus KWin should use the generic Wayland icon if no icon is found for a Wayland client. With this change applications with incorrect desktop file name at least get a generic icon instead of no icon. Test Plan: Started Qt assistant on Wayland and it had icon. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel, kwin Tags: #plasma_on_wayland, #kwin Differential Revision: https://phabricator.kde.org/D3023
1 files changed, 4 insertions, 2 deletions
diff --git a/shell_client.cpp b/shell_client.cpp
index 28201f4..104e9ef 100644
--- a/shell_client.cpp
+++ b/shell_client.cpp
@@ -1155,18 +1155,20 @@ bool ShellClient::hasStrut() const
void ShellClient::updateIcon()
+ const QString waylandIconName = QStringLiteral("wayland");
QString desktopFile;
if (m_shellSurface) {
desktopFile = QString::fromUtf8(m_shellSurface->windowClass());
if (desktopFile.isEmpty()) {
- setIcon(QIcon());
+ setIcon(QIcon::fromTheme(waylandIconName));
if (!desktopFile.endsWith(QLatin1String(".desktop"))) {
KDesktopFile df(desktopFile);
- setIcon(QIcon::fromTheme(df.readIcon()));
+ const QString iconName = df.readIcon();
+ setIcon(QIcon::fromTheme(iconName.isEmpty() ? waylandIconName : iconName));
bool ShellClient::isTransient() const