diff --git a/libtaskmanager/xwindowtasksmodel.cpp b/libtaskmanager/xwindowtasksmodel.cpp --- a/libtaskmanager/xwindowtasksmodel.cpp +++ b/libtaskmanager/xwindowtasksmodel.cpp @@ -23,6 +23,7 @@ #include "tasktools.h" #include +#include #include #include #include @@ -50,9 +51,9 @@ { static const NET::Properties windowInfoFlags = NET::WMState | NET::XAWMState | NET::WMDesktop | - NET::WMVisibleName | NET::WMGeometry | NET::WMFrameExtents | - NET::WMWindowType; -static const NET::Properties2 windowInfoFlags2 = NET::WM2WindowClass | NET::WM2AllowedActions; + NET::WMVisibleName | NET::WMGeometry | NET::WMFrameExtents | NET::WMWindowType; +static const NET::Properties2 windowInfoFlags2 = NET::WM2DesktopFileName | NET::WM2Activities | + NET::WM2WindowClass | NET::WM2AllowedActions; class XWindowTasksModel::Private { @@ -88,7 +89,6 @@ QUrl launcherUrl(WId window, bool encodeFallbackIcon = true); QUrl serviceUrl(int pid, const QString &type, const QStringList &cmdRemovals); KService::List servicesFromPid(int pid); - QStringList activities(WId window); bool demandsAttention(WId window); private: @@ -341,8 +341,8 @@ bool wipeAppDataCache = false; QVector changedRoles; - if (properties & (NET::WMName | NET::WMVisibleName | NET::WM2WindowClass | NET::WMPid) - || properties2 & NET::WM2WindowClass) { + if (properties & (NET::WMName | NET::WMVisibleName | NET::WMPid) + || properties2 & (NET::WM2DesktopFileName | NET::WM2WindowClass)) { wipeInfoCache = true; wipeAppDataCache = true; changedRoles << Qt::DisplayRole << Qt::DecorationRole << AppId << AppName << GenericName << LauncherUrl; @@ -484,6 +484,21 @@ QUrl url; const KWindowInfo *info = windowInfo(window); + + const QString &desktopFile = QString::fromUtf8(info->desktopFileName()); + + if (!desktopFile.isEmpty()) { + KService::Ptr service = KService::serviceByStorageId(desktopFile); + + if (service) { + return QUrl::fromLocalFile(service->entryPath()); + } + + if (KDesktopFile::isDesktopFile(desktopFile) && QFile::exists(desktopFile)) { + return QUrl::fromLocalFile(desktopFile); + } + } + const QString &classClass = info->windowClassClass(); const QString &className = info->windowClassName(); @@ -801,19 +816,6 @@ return services; } -QStringList XWindowTasksModel::Private::activities(WId window) -{ - NETWinInfo ni(QX11Info::connection(), window, QX11Info::appRootWindow(), 0, NET::WM2Activities); - - const QString result(ni.activities()); - - if (!result.isEmpty() && result != QLatin1String("00000000-0000-0000-0000-000000000000")) { - return result.split(','); - } - - return QStringList(); -} - bool XWindowTasksModel::Private::demandsAttention(WId window) { if (windows.contains(window)) { @@ -905,7 +907,7 @@ } else if (role == ScreenGeometry) { return screenGeometry(d->windowInfo(window)->frameGeometry().center()); } else if (role == Activities) { - return d->activities(window); + return d->windowInfo(window)->activities(); } else if (role == IsDemandingAttention) { return d->demandsAttention(window); } else if (role == SkipTaskbar) {