diff --git a/kcms/notifications/sourcesmodel.cpp b/kcms/notifications/sourcesmodel.cpp --- a/kcms/notifications/sourcesmodel.cpp +++ b/kcms/notifications/sourcesmodel.cpp @@ -38,6 +38,8 @@ #include +static const QString s_plasmaWorkspaceNotifyRcName = QStringLiteral("plasma_workspace"); + SourcesModel::SourcesModel(QObject *parent) : QAbstractItemModel(parent) { @@ -342,11 +344,9 @@ desktopEntries.append(service->desktopEntryName()); } - auto sortData = [&collator](const SourceData &a, const SourceData &b) { + std::sort(appsData.begin(), appsData.end(), [&collator](const SourceData &a, const SourceData &b) { return collator.compare(a.display(), b.display()) < 0; - }; - - std::sort(appsData.begin(), appsData.end(), sortData); + }); // Fake entry for configuring non-identifyable applications appsData << SourceData{ @@ -358,7 +358,16 @@ {} }; - std::sort(servicesData.begin(), servicesData.end(), sortData); + // Sort and make sure plasma_workspace is at the beginning of the list + std::sort(servicesData.begin(), servicesData.end(), [&collator](const SourceData &a, const SourceData &b) { + if (a.notifyRcName == s_plasmaWorkspaceNotifyRcName) { + return true; + } + if (b.notifyRcName == s_plasmaWorkspaceNotifyRcName) { + return false; + } + return collator.compare(a.display(), b.display()) < 0; + }); m_data << appsData << servicesData;