minor fixes

This commit is contained in:
Vaxry 2024-02-13 16:46:33 +00:00
parent 838ea2c9aa
commit 3566efa667
3 changed files with 10 additions and 4 deletions

View file

@ -1171,8 +1171,11 @@ void* const* CConfigManager::getConfigValuePtr(const std::string& val) {
return VAL->getDataStaticPtr(); return VAL->getDataStaticPtr();
} }
Hyprlang::CConfigValue* CConfigManager::getHyprlangConfigValuePtr(const std::string& val) { Hyprlang::CConfigValue* CConfigManager::getHyprlangConfigValuePtr(const std::string& name, const std::string& specialCat) {
return m_pConfig->getConfigValuePtr(val.c_str()); if (!specialCat.empty())
return m_pConfig->getSpecialConfigValuePtr(specialCat.c_str(), name.c_str(), nullptr);
return m_pConfig->getConfigValuePtr(name.c_str());
} }
bool CConfigManager::deviceConfigExists(const std::string& dev) { bool CConfigManager::deviceConfigExists(const std::string& dev) {
@ -1378,7 +1381,7 @@ void CConfigManager::removePluginConfig(HANDLE handle) {
if (h != handle) if (h != handle)
continue; continue;
m_pConfig->removeSpecialConfigValue("plugin:", n.c_str()); m_pConfig->removeSpecialConfigValue("plugin", n.c_str());
} }
std::erase_if(pluginVariables, [handle](const auto& other) { return other.handle == handle; }); std::erase_if(pluginVariables, [handle](const auto& other) { return other.handle == handle; });
} }

View file

@ -97,7 +97,7 @@ class CConfigManager {
bool shouldBlurLS(const std::string&); bool shouldBlurLS(const std::string&);
void* const* getConfigValuePtr(const std::string&); void* const* getConfigValuePtr(const std::string&);
Hyprlang::CConfigValue* getHyprlangConfigValuePtr(const std::string&); Hyprlang::CConfigValue* getHyprlangConfigValuePtr(const std::string& name, const std::string& specialCat = "");
void onPluginLoadUnload(const std::string& name, bool load); void onPluginLoadUnload(const std::string& name, bool load);
static std::string getConfigDir(); static std::string getConfigDir();
static std::string getMainConfigPath(); static std::string getMainConfigPath();

View file

@ -182,6 +182,9 @@ APICALL Hyprlang::CConfigValue* HyprlandAPI::getConfigValue(HANDLE handle, const
if (!PLUGIN) if (!PLUGIN)
return nullptr; return nullptr;
if (name.starts_with("plugin:"))
return g_pConfigManager->getHyprlangConfigValuePtr(name.substr(7), "plugin");
return g_pConfigManager->getHyprlangConfigValuePtr(name); return g_pConfigManager->getHyprlangConfigValuePtr(name);
} }