Summary:
WM_CLASS instance and general classes are checked against StartupWMClass
prior to most rewrite and mapping rules, and prior to the DesktopEntryName
and Name checks.
This matches the fd.o spec more closely and makes Chrome Apps and
LibreOffice work without special mapping rules, which is also a speed
win.
Reviewers: #plasma, davidedmundson, broulik
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D4706
// If no "Target" is provided, instead assume the matched property (ClassClass/ClassName).
if(rewrittenString.isEmpty()){
rewrittenString=matchProperty;
}
services=KServiceTypeTrader::self()->query(QStringLiteral("Application"),QStringLiteral("exist Exec and ('%1' =~ %2)").arg(rewrittenString,serviceSearchIdentifier));
if(!services.isEmpty()){
break;
}
}
}
}
}
// Try matching mapped name against DesktopEntryName.
if(!mapped.isEmpty()&&services.empty()){
services=KServiceTypeTrader::self()->query(QStringLiteral("Application"),QStringLiteral("exist Exec and ('%1' =~ DesktopEntryName)").arg(mapped));
}
// Try matching mapped name against 'Name'.
if(!mapped.isEmpty()&&services.empty()){
services=KServiceTypeTrader::self()->query(QStringLiteral("Application"),QStringLiteral("exist Exec and ('%1' =~ Name)").arg(mapped));
}
// To match other docks (docky, unity, etc.) attempt to match on DesktopEntryName first ...
// Try matching WM_CLASS general class against DesktopEntryName.
if(services.empty()){
services=KServiceTypeTrader::self()->query(QStringLiteral("Application"),QStringLiteral("exist Exec and ('%1' =~ DesktopEntryName)").arg(classClass));
}
// Try StartupWMClass.
if(services.empty()){
services=KServiceTypeTrader::self()->query(QStringLiteral("Application"),QStringLiteral("exist Exec and ('%1' =~ StartupWMClass)").arg(classClass));
}
// Try 'Name' - unfortunately this can be translated, so has a good chance of failing! (As it does for KDE's own "System Settings" (even in English!!))
// Try matching WM_CLASS general class against 'Name'.
// This has a shaky chance of success as WM_CLASS is untranslated, but 'Name' may be localized.
if(services.empty()){
services=KServiceTypeTrader::self()->query(QStringLiteral("Application"),QStringLiteral("exist Exec and ('%1' =~ Name)").arg(classClass));