summaryrefslogtreecommitdiff
path: root/src/config/ConfigManager.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2025-01-24 20:30:12 +0000
committerVaxry <vaxry@vaxry.net>2025-01-24 20:30:21 +0000
commitd8f79d7678f428738f3173020109bd7b7fbd0840 (patch)
tree8efc7a843e1f82cd7fcfb3c544124075a7d68782 /src/config/ConfigManager.cpp
parent80b2fd135b45f2c2e41ceb312314908f6a3e7b30 (diff)
core: add --verify-config to verify the config with Hyprland
fixes #9135
Diffstat (limited to 'src/config/ConfigManager.cpp')
-rw-r--r--src/config/ConfigManager.cpp30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index f5c9b3ee..c5d70329 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -19,6 +19,7 @@
#include "../render/Renderer.hpp"
#include "../hyprerror/HyprError.hpp"
#include "../managers/input/InputManager.hpp"
+#include "../managers/eventLoop/EventLoopManager.hpp"
#include "../managers/LayoutManager.hpp"
#include "../managers/EventManager.hpp"
#include "../debug/HyprNotificationOverlay.hpp"
@@ -730,15 +731,18 @@ CConfigManager::CConfigManager() {
resetHLConfig();
- Debug::log(INFO,
- "!!!!HEY YOU, YES YOU!!!!: further logs to stdout / logfile are disabled by default. BEFORE SENDING THIS LOG, ENABLE THEM. Use debug:disable_logs = false to do so: "
- "https://wiki.hyprland.org/Configuring/Variables/#debug");
+ if (!g_pCompositor->m_bOnlyConfigVerification) {
+ Debug::log(
+ INFO,
+ "!!!!HEY YOU, YES YOU!!!!: further logs to stdout / logfile are disabled by default. BEFORE SENDING THIS LOG, ENABLE THEM. Use debug:disable_logs = false to do so: "
+ "https://wiki.hyprland.org/Configuring/Variables/#debug");
+ }
Debug::disableLogs = reinterpret_cast<int64_t* const*>(m_pConfig->getConfigValuePtr("debug:disable_logs")->getDataStaticPtr());
Debug::disableTime = reinterpret_cast<int64_t* const*>(m_pConfig->getConfigValuePtr("debug:disable_time")->getDataStaticPtr());
- if (ERR.has_value())
- g_pHyprError->queueCreate(ERR.value(), CHyprColor{1.0, 0.1, 0.1, 1.0});
+ if (g_pEventLoopManager && ERR.has_value())
+ g_pEventLoopManager->doLater([ERR] { g_pHyprError->queueCreate(ERR.value(), CHyprColor{1.0, 0.1, 0.1, 1.0}); });
}
std::optional<std::string> CConfigManager::generateConfig(std::string configPath) {
@@ -820,11 +824,23 @@ void CConfigManager::reload() {
EMIT_HOOK_EVENT("preConfigReload", nullptr);
setDefaultAnimationVars();
resetHLConfig();
- configCurrentPath = getMainConfigPath();
- const auto ERR = m_pConfig->parse();
+ configCurrentPath = getMainConfigPath();
+ const auto ERR = m_pConfig->parse();
+ m_bLastConfigVerificationWasSuccessful = !ERR.error;
postConfigReload(ERR);
}
+std::string CConfigManager::verify() {
+ setDefaultAnimationVars();
+ resetHLConfig();
+ configCurrentPath = getMainConfigPath();
+ const auto ERR = m_pConfig->parse();
+ m_bLastConfigVerificationWasSuccessful = !ERR.error;
+ if (ERR.error)
+ return ERR.getError();
+ return "config ok";
+}
+
void CConfigManager::setDefaultAnimationVars() {
m_AnimationTree.createNode("__internal_fadeCTM");
m_AnimationTree.createNode("global");