From aaa5573c73636a76dd3ae4758bfd89ae4d5eeb8a Mon Sep 17 00:00:00 2001 From: vaxerski Date: Wed, 29 Jan 2025 10:50:39 +0000 Subject: [PATCH] config/hyprctl: fix keyword not updating autoreload ref #9139 --- src/config/ConfigManager.cpp | 8 ++++++-- src/config/ConfigManager.hpp | 1 + src/debug/HyprCtl.cpp | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index daff9285c..047c58d94 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -912,12 +912,16 @@ std::optional CConfigManager::resetHLConfig() { return RET; } +void CConfigManager::updateWatcher() { + static const auto PDISABLEAUTORELOAD = CConfigValue("misc:disable_autoreload"); + g_pConfigWatcher->setWatchList(*PDISABLEAUTORELOAD ? std::vector{} : m_configPaths); +} + void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) { static const auto PENABLEEXPLICIT = CConfigValue("render:explicit_sync"); - static const auto PDISABLEAUTORELOAD = CConfigValue("misc:disable_autoreload"); static int prevEnabledExplicit = *PENABLEEXPLICIT; - g_pConfigWatcher->setWatchList(*PDISABLEAUTORELOAD ? std::vector{} : m_configPaths); + updateWatcher(); for (auto const& w : g_pCompositor->m_vWindows) { w->uncacheWindowDecos(); diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index ae0ba7595..f06968827 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -190,6 +190,7 @@ class CConfigManager { void ensureVRR(PHLMONITOR pMonitor = nullptr); bool shouldUseSoftwareCursors(); + void updateWatcher(); std::string parseKeyword(const std::string&, const std::string&); diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index cfdba1001..359428b1a 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -1100,6 +1100,9 @@ static std::string dispatchKeyword(eHyprCtlOutputFormat format, std::string in) } } + if (COMMAND.contains("misc:disable_autoreload")) + g_pConfigManager->updateWatcher(); + // decorations will probably need a repaint if (COMMAND.contains("decoration:") || COMMAND.contains("border") || COMMAND == "workspace" || COMMAND.contains("zoom_factor") || COMMAND == "source" || COMMAND.starts_with("windowrule")) {