mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-08 16:11:57 -07:00
config: avoid querying the fs every tick
This commit is contained in:
@@ -716,6 +716,7 @@ std::optional<std::string> CConfigManager::generateConfig(std::string configPath
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string CConfigManager::getMainConfigPath() {
|
std::string CConfigManager::getMainConfigPath() {
|
||||||
|
static std::string CONFIG_PATH = [this]() -> std::string {
|
||||||
if (!g_pCompositor->explicitConfigPath.empty())
|
if (!g_pCompositor->explicitConfigPath.empty())
|
||||||
return g_pCompositor->explicitConfigPath;
|
return g_pCompositor->explicitConfigPath;
|
||||||
|
|
||||||
@@ -730,6 +731,9 @@ std::string CConfigManager::getMainConfigPath() {
|
|||||||
return generateConfig(CONFIGPATH).value();
|
return generateConfig(CONFIGPATH).value();
|
||||||
} else
|
} else
|
||||||
throw std::runtime_error("Neither HOME nor XDG_CONFIG_HOME are set in the environment. Could not find config in XDG_CONFIG_DIRS or /etc/xdg.");
|
throw std::runtime_error("Neither HOME nor XDG_CONFIG_HOME are set in the environment. Could not find config in XDG_CONFIG_DIRS or /etc/xdg.");
|
||||||
|
}();
|
||||||
|
|
||||||
|
return CONFIG_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<std::string> CConfigManager::verifyConfigExists() {
|
std::optional<std::string> CConfigManager::verifyConfigExists() {
|
||||||
|
@@ -163,7 +163,7 @@ class CConfigManager {
|
|||||||
|
|
||||||
void* const* getConfigValuePtr(const std::string&);
|
void* const* getConfigValuePtr(const std::string&);
|
||||||
Hyprlang::CConfigValue* getHyprlangConfigValuePtr(const std::string& name, const std::string& specialCat = "");
|
Hyprlang::CConfigValue* getHyprlangConfigValuePtr(const std::string& name, const std::string& specialCat = "");
|
||||||
static std::string getMainConfigPath();
|
std::string getMainConfigPath();
|
||||||
std::string getConfigString();
|
std::string getConfigString();
|
||||||
|
|
||||||
SMonitorRule getMonitorRuleFor(const PHLMONITOR);
|
SMonitorRule getMonitorRuleFor(const PHLMONITOR);
|
||||||
@@ -304,8 +304,8 @@ class CConfigManager {
|
|||||||
void updateBlurredLS(const std::string&, const bool);
|
void updateBlurredLS(const std::string&, const bool);
|
||||||
void setDefaultAnimationVars();
|
void setDefaultAnimationVars();
|
||||||
std::optional<std::string> resetHLConfig();
|
std::optional<std::string> resetHLConfig();
|
||||||
static std::optional<std::string> generateConfig(std::string configPath);
|
std::optional<std::string> generateConfig(std::string configPath);
|
||||||
static std::optional<std::string> verifyConfigExists();
|
std::optional<std::string> verifyConfigExists();
|
||||||
void postConfigReload(const Hyprlang::CParseResult& result);
|
void postConfigReload(const Hyprlang::CParseResult& result);
|
||||||
void reload();
|
void reload();
|
||||||
SWorkspaceRule mergeWorkspaceRules(const SWorkspaceRule&, const SWorkspaceRule&);
|
SWorkspaceRule mergeWorkspaceRules(const SWorkspaceRule&, const SWorkspaceRule&);
|
||||||
|
Reference in New Issue
Block a user