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();
}
Hyprlang::CConfigValue* CConfigManager::getHyprlangConfigValuePtr(const std::string& val) {
return m_pConfig->getConfigValuePtr(val.c_str());
Hyprlang::CConfigValue* CConfigManager::getHyprlangConfigValuePtr(const std::string& name, const std::string& specialCat) {
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) {
@ -1378,7 +1381,7 @@ void CConfigManager::removePluginConfig(HANDLE handle) {
if (h != handle)
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; });
}

View file

@ -97,7 +97,7 @@ class CConfigManager {
bool shouldBlurLS(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);
static std::string getConfigDir();
static std::string getMainConfigPath();

View file

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