pluginapi: add a config keyword adding method
This commit is contained in:
parent
7f4b0aaadc
commit
af9440152e
4 changed files with 47 additions and 3 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -114,6 +114,14 @@ namespace HyprlandAPI {
|
|||
*/
|
||||
APICALL bool addConfigValue(HANDLE handle, const std::string& name, const SConfigValue& value);
|
||||
|
||||
/*
|
||||
Add a config keyword.
|
||||
This method may only be called in "pluginInit"
|
||||
|
||||
returns: true on success, false on fail
|
||||
*/
|
||||
APICALL bool addConfigKeyword(HANDLE handle, const std::string& name, std::function<void(const std::string& key, const std::string& val)> fn);
|
||||
|
||||
/*
|
||||
Get a config value.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue