kcms/rules: Notify when a window does not provide a class
Some applications do not provide a window class according to the spec (WM_CLASS on X11, appId on Wayland), so KWin cannot "detect" this property. In those cases, notify the user that this is a bug within the application (so it is not confused for a KWin misbehavior) and also prevent setting a wrong description. BUG: 462644 FIXED-IN: 5.27
This commit is contained in:
parent
bee2c65918
commit
e8545fdb37
2 changed files with 17 additions and 2 deletions
|
@ -419,7 +419,9 @@ void KCMKWinRules::fillSettingsFromProperties(RuleSettings *settings, const QVar
|
|||
settings->setDefaults();
|
||||
|
||||
if (wholeApp) {
|
||||
settings->setDescription(i18n("Application settings for %1", wmclass_class));
|
||||
if (!wmclass_class.isEmpty()) {
|
||||
settings->setDescription(i18n("Application settings for %1", wmclass_class));
|
||||
}
|
||||
// TODO maybe exclude some types? If yes, then also exclude them when searching.
|
||||
settings->setTypes(NET::AllTypesMask);
|
||||
settings->setTitlematch(Rules::UnimportantMatch);
|
||||
|
@ -439,7 +441,9 @@ void KCMKWinRules::fillSettingsFromProperties(RuleSettings *settings, const QVar
|
|||
return;
|
||||
}
|
||||
|
||||
settings->setDescription(i18n("Window settings for %1", wmclass_class));
|
||||
if (!wmclass_class.isEmpty()) {
|
||||
settings->setDescription(i18n("Window settings for %1", wmclass_class));
|
||||
}
|
||||
if (type == NET::Unknown) {
|
||||
settings->setTypes(NET::NormalMask);
|
||||
} else {
|
||||
|
|
|
@ -697,6 +697,17 @@ void RulesModel::setSuggestedProperties(const QVariantMap &info)
|
|||
const QString wmcompleteclass = QStringLiteral("%1 %2").arg(info.value("resourceName").toString(),
|
||||
info.value("resourceClass").toString());
|
||||
|
||||
// This window is not providing the class according to spec (WM_CLASS on X11, appId on Wayland)
|
||||
// Notify the user that this is a bug within the application, so there's nothing we can do
|
||||
if (wmsimpleclass.isEmpty()) {
|
||||
Q_EMIT showErrorMessage(i18n("Window class not available"),
|
||||
xi18nc("@info", "This application is not providing a class for the window, "
|
||||
"so KWin cannot use it to match and apply any rules. "
|
||||
"If you still want to apply some rules to it, "
|
||||
"try to match other properties like the window title instead.<nl/><nl/>"
|
||||
"Please consider reporting this bug to the application's developers."));
|
||||
}
|
||||
|
||||
m_rules["wmclass"]->setSuggestedValue(wmsimpleclass);
|
||||
m_rules["wmclasshelper"]->setSuggestedValue(wmcompleteclass);
|
||||
|
||||
|
|
Loading…
Reference in a new issue