config: fix layout invalidation for keyword commands (#4826)

This commit is contained in:
JManch 2024-02-24 14:06:28 +00:00 committed by GitHub
parent 6f83856025
commit e9528fc214
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -818,16 +818,12 @@ void CConfigManager::init() {
} }
std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::string& VALUE) { std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::string& VALUE) {
int needsLayoutRecalc = COMMAND == "monitor"; // 0 - no, 1 - yes, 2 - maybe
const auto RET = m_pConfig->parseDynamic(COMMAND.c_str(), VALUE.c_str()); const auto RET = m_pConfig->parseDynamic(COMMAND.c_str(), VALUE.c_str());
// invalidate layouts if they changed // invalidate layouts if they changed
if (needsLayoutRecalc) { if (COMMAND == "monitor" || COMMAND.contains("gaps_") || COMMAND.starts_with("dwindle:") || COMMAND.starts_with("master:")) {
if (needsLayoutRecalc == 1 || COMMAND.contains("gaps_") || COMMAND.starts_with("dwindle:") || COMMAND.starts_with("master:")) { for (auto& m : g_pCompositor->m_vMonitors)
for (auto& m : g_pCompositor->m_vMonitors) g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
}
} }
// Update window border colors // Update window border colors