From af9440152e19cee74b675e53087e032b9ccb5459 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 29 Oct 2023 16:59:50 +0000 Subject: pluginapi: add a config keyword adding method --- src/plugins/PluginAPI.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/plugins/PluginAPI.cpp') 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 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); -- cgit v1.2.3