config: Config error limit/hyprctl (#5165)
* Add error_limit to limit the number of config error messages shown in notification * Add configerrors hyprctl command * Formatting * Formatting for not my code * Use CVarList, add escapeJSONStrings * Add indication there are more undisplayed errors * Restore suppress_errors; move getErrors() to ConfigManager * Formatting, wtf * Format
This commit is contained in:
parent
214ec82ba7
commit
4c796683c0
4 changed files with 54 additions and 3 deletions
|
|
@ -372,6 +372,7 @@ CConfigManager::CConfigManager() {
|
|||
m_pConfig->addConfigValue("debug:damage_tracking", {(Hyprlang::INT)DAMAGE_TRACKING_FULL});
|
||||
m_pConfig->addConfigValue("debug:manual_crash", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("debug:suppress_errors", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("debug:error_limit", Hyprlang::INT{5});
|
||||
m_pConfig->addConfigValue("debug:watchdog_timeout", Hyprlang::INT{5});
|
||||
m_pConfig->addConfigValue("debug:disable_scale_checks", Hyprlang::INT{0});
|
||||
|
||||
|
|
@ -609,6 +610,10 @@ std::string CConfigManager::getMainConfigPath() {
|
|||
return getConfigDir() + "/hypr/" + (ISDEBUG ? "hyprlandd.conf" : "hyprland.conf");
|
||||
}
|
||||
|
||||
std::string CConfigManager::getErrors() {
|
||||
return m_szConfigErrors;
|
||||
}
|
||||
|
||||
void CConfigManager::reload() {
|
||||
EMIT_HOOK_EVENT("preConfigReload", nullptr);
|
||||
setDefaultAnimationVars();
|
||||
|
|
@ -740,6 +745,12 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
|
|||
g_pHyprOpenGL->m_bReloadScreenShader = true;
|
||||
|
||||
// parseError will be displayed next frame
|
||||
|
||||
if (result.error)
|
||||
m_szConfigErrors = result.getError();
|
||||
else
|
||||
m_szConfigErrors = "";
|
||||
|
||||
if (result.error && !std::any_cast<Hyprlang::INT>(m_pConfig->getConfigValue("debug:suppress_errors")))
|
||||
g_pHyprError->queueCreate(result.getError(), CColor(1.0, 50.0 / 255.0, 50.0 / 255.0, 1.0));
|
||||
else if (std::any_cast<Hyprlang::INT>(m_pConfig->getConfigValue("autogenerated")) == 1)
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ class CConfigManager {
|
|||
void addExecRule(const SExecRequestedRule&);
|
||||
|
||||
void handlePluginLoads();
|
||||
std::string getErrors();
|
||||
|
||||
// keywords
|
||||
std::optional<std::string> handleRawExec(const std::string&, const std::string&);
|
||||
|
|
@ -193,6 +194,7 @@ class CConfigManager {
|
|||
std::deque<std::string> firstExecRequests;
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> m_vFailedPluginConfigValues; // for plugin values of unloaded plugins
|
||||
std::string m_szConfigErrors = "";
|
||||
|
||||
// internal methods
|
||||
void setAnimForChildren(SAnimationPropertyConfig* const);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue