diff options
| author | Vaxry <vaxry@vaxry.net> | 2023-10-29 16:59:50 +0000 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2023-10-29 16:59:50 +0000 |
| commit | af9440152e19cee74b675e53087e032b9ccb5459 (patch) | |
| tree | 537f79cad30a7c35b25ca549e5ae865f6fc2b303 /src/plugins/PluginAPI.cpp | |
| parent | 7f4b0aaadc8348e8814285d7ec582cf737b62d3b (diff) | |
pluginapi: add a config keyword adding method
Diffstat (limited to 'src/plugins/PluginAPI.cpp')
| -rw-r--r-- | src/plugins/PluginAPI.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/PluginAPI.cpp b/src/plugins/PluginAPI.cpp index 8d2f6627..a873644e 100644 --- a/src/plugins/PluginAPI.cpp +++ b/src/plugins/PluginAPI.cpp @@ -160,6 +160,19 @@ APICALL bool HyprlandAPI::addConfigValue(HANDLE handle, const std::string& name, return true; } +APICALL bool HyprlandAPI::addConfigKeyword(HANDLE handle, const std::string& name, std::function<void(const std::string& key, const std::string& val)> fn) { + auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle); + + if (!g_pPluginSystem->m_bAllowConfigVars) + return false; + + if (!PLUGIN) + return false; + + g_pConfigManager->addPluginKeyword(handle, name, fn); + return true; +} + APICALL SConfigValue* HyprlandAPI::getConfigValue(HANDLE handle, const std::string& name) { auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle); |
