Specify scripted effect kcm using X-KDE-ConfigModule
At the moment, if an effect wants to have a configure button in the desktop effects kcm, it needs to add X-KDE-PluginKeyword field with its plugin id. This is confusing. This change ports scripted effects to X-KDE-ConfigModule, which is more intuitive than X-KDE-PluginKeyword. kcm_kwin4_genericscriptedconfig is a special config module that loads config.ui from KPackage. However, an effect can specify a different config module in the metadata if kcm_kwin4_genericscriptedconfig doesn't suit their needs.
This commit is contained in:
parent
2c29dfd596
commit
7ae4497d5b
8 changed files with 16 additions and 14 deletions
|
@ -14,7 +14,7 @@
|
|||
"License": "GPL",
|
||||
"Name": "Quick Effect"
|
||||
},
|
||||
"X-KDE-ConfigModule": "kcm_kwin4_genericscripted",
|
||||
"X-KDE-Ordering": 60,
|
||||
"X-KDE-PluginKeyword": "quick-effect",
|
||||
"X-Plasma-API": "declarativescript"
|
||||
}
|
||||
|
|
|
@ -298,13 +298,16 @@ void EffectsModel::loadJavascriptEffects(const KConfigGroup &kwinConfig)
|
|||
effect.exclusiveGroup = plugin.value(QStringLiteral("X-KWin-Exclusive-Category"));
|
||||
effect.internal = plugin.value(QStringLiteral("X-KWin-Internal"), false);
|
||||
|
||||
const QString pluginKeyword = plugin.value(QStringLiteral("X-KDE-PluginKeyword"));
|
||||
if (!pluginKeyword.isEmpty()) {
|
||||
const QString xmlFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("kwin/effects/") + plugin.pluginId() + QLatin1String("/contents/config/main.xml"));
|
||||
const QString uiFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("kwin/effects/") + plugin.pluginId() + QLatin1String("/contents/ui/config.ui"));
|
||||
if (QFileInfo::exists(xmlFile) && QFileInfo::exists(uiFile)) {
|
||||
effect.configModule = QStringLiteral("kcm_kwin4_genericscripted");
|
||||
effect.configArgs = QVariantList{plugin.pluginId(), QStringLiteral("KWin/Effect")};
|
||||
if (const QString configModule = plugin.value(QStringLiteral("X-KDE-ConfigModule")); !configModule.isEmpty()) {
|
||||
if (configModule == QStringLiteral("kcm_kwin4_genericscripted")) {
|
||||
const QString xmlFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("kwin/effects/") + plugin.pluginId() + QLatin1String("/contents/config/main.xml"));
|
||||
const QString uiFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("kwin/effects/") + plugin.pluginId() + QLatin1String("/contents/ui/config.ui"));
|
||||
if (QFileInfo::exists(xmlFile) && QFileInfo::exists(uiFile)) {
|
||||
effect.configModule = configModule;
|
||||
effect.configArgs = QVariantList{plugin.pluginId(), QStringLiteral("KWin/Effect")};
|
||||
}
|
||||
} else {
|
||||
effect.configModule = configModule;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,8 +115,8 @@
|
|||
"Name[zh_CN]": "无响应窗口灰化",
|
||||
"Name[zh_TW]": "降低無回應應用程式的飽和度"
|
||||
},
|
||||
"X-KDE-ConfigModule": "kcm_kwin4_genericscripted",
|
||||
"X-KDE-Ordering": 60,
|
||||
"X-KDE-PluginKeyword": "frozenapp",
|
||||
"X-KWin-Config-TranslationDomain": "kwin",
|
||||
"X-Plasma-API": "javascript"
|
||||
}
|
||||
|
|
|
@ -115,8 +115,8 @@
|
|||
"Name[zh_CN]": "登录渐变动画",
|
||||
"Name[zh_TW]": "登入"
|
||||
},
|
||||
"X-KDE-ConfigModule": "kcm_kwin4_genericscripted",
|
||||
"X-KDE-Ordering": 40,
|
||||
"X-KDE-PluginKeyword": "login",
|
||||
"X-KWin-Config-TranslationDomain": "kwin",
|
||||
"X-Plasma-API": "javascript"
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
"Name[zh_CN]": "最小化全部",
|
||||
"Name[zh_TW]": "全部最小化"
|
||||
},
|
||||
"X-KDE-PluginKeyword": "minimizeall",
|
||||
"X-KDE-ConfigModule": "kcm_kwin4_genericscripted",
|
||||
"X-KWin-Border-Activate": "true",
|
||||
"X-Plasma-API": "javascript"
|
||||
}
|
||||
|
|
|
@ -122,8 +122,8 @@
|
|||
"Name[zh_CN]": "按比例缩放",
|
||||
"Name[zh_TW]": "縮放"
|
||||
},
|
||||
"X-KDE-ConfigModule": "kcm_kwin4_genericscripted",
|
||||
"X-KDE-Ordering": 60,
|
||||
"X-KDE-PluginKeyword": "scale",
|
||||
"X-KWin-Config-TranslationDomain": "kwin",
|
||||
"X-KWin-Exclusive-Category": "toplevel-open-close-animation",
|
||||
"X-Plasma-API": "javascript"
|
||||
|
|
|
@ -114,8 +114,8 @@
|
|||
"Name[zh_CN]": "窗口透明度",
|
||||
"Name[zh_TW]": "半透明"
|
||||
},
|
||||
"X-KDE-ConfigModule": "kcm_kwin4_genericscripted",
|
||||
"X-KDE-Ordering": 50,
|
||||
"X-KDE-PluginKeyword": "translucency",
|
||||
"X-KWin-Config-TranslationDomain": "kwin",
|
||||
"X-Plasma-API": "javascript"
|
||||
}
|
||||
|
|
|
@ -113,6 +113,5 @@
|
|||
"Name[zh_TW]": "影片牆"
|
||||
},
|
||||
"X-KDE-ConfigModule": "kwin/effects/configs/kcm_kwin4_genericscripted",
|
||||
"X-KDE-PluginKeyword": "videowall",
|
||||
"X-Plasma-API": "javascript"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue