kcmkwin/rules: Fix suggested values for virtual desktops rule
If the virtual desktops rule is created, only the last virtual desktop the window is on is going to be checked. With this, all virtual desktops that the window is currently on will be checked. Technically, it's an api breaking change, but the window rules kcm is the primary user of queryWindowInfo() so I don't think it's a big deal.
This commit is contained in:
parent
57a8d5ca50
commit
66badd905b
2 changed files with 3 additions and 14 deletions
|
@ -202,7 +202,7 @@ QVariantMap clientToVariantMap(const AbstractClient *c)
|
|||
{QStringLiteral("y"), c->y()},
|
||||
{QStringLiteral("width"), c->width()},
|
||||
{QStringLiteral("height"), c->height()},
|
||||
{QStringLiteral("x11DesktopNumber"), c->desktop()},
|
||||
{QStringLiteral("desktops"), c->desktopIds()},
|
||||
{QStringLiteral("minimized"), c->isMinimized()},
|
||||
{QStringLiteral("shaded"), c->isShade()},
|
||||
{QStringLiteral("fullscreen"), c->isFullScreen()},
|
||||
|
|
|
@ -670,7 +670,8 @@ const QHash<QString, QString> RulesModel::x11PropertyHash()
|
|||
{ "skipPager", "skippager" },
|
||||
{ "skipSwitcher", "skipswitcher" },
|
||||
{ "type", "type" },
|
||||
{ "desktopFile", "desktopfile" }
|
||||
{ "desktopFile", "desktopfile" },
|
||||
{ "desktops", "desktops" },
|
||||
};
|
||||
return propertyToRule;
|
||||
};
|
||||
|
@ -699,18 +700,6 @@ void RulesModel::setSuggestedProperties(const QVariantMap &info)
|
|||
m_rules["wmclass"]->setSuggestedValue(wmsimpleclass);
|
||||
m_rules["wmclasshelper"]->setSuggestedValue(wmcompleteclass);
|
||||
|
||||
//TODO: Make the DBus method `queryWindowInfo` return the list of desktop IDs and use them directly
|
||||
if (info.value("x11DesktopNumber").toInt() == NET::OnAllDesktops) {
|
||||
m_rules["desktops"]->setSuggestedValue(QStringList());
|
||||
} else {
|
||||
for (const auto vd : qAsConst(m_virtualDesktops)) {
|
||||
if (info.value("x11DesktopNumber").toUInt() == vd.position + 1) {
|
||||
m_rules["desktops"]->setSuggestedValue(QStringList{ vd.id });
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef KWIN_BUILD_ACTIVITIES
|
||||
const QStringList activities = info.value("activities").toStringList();
|
||||
m_rules["activity"]->setSuggestedValue(activities.isEmpty() ? QStringList{ Activities::nullUuid() }
|
||||
|
|
Loading…
Reference in a new issue