summaryrefslogtreecommitdiff
path: root/src/config/ConfigManager.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-11-28 19:05:50 +0000
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-11-28 19:05:50 +0000
commit12df7995725003eec4fb5dba5cc070b2630ce2e1 (patch)
tree7949906c8ef736b24572d30bed694f458b46bc66 /src/config/ConfigManager.cpp
parentc341792092d024bd370af39262e1f4b6ed805544 (diff)
recalculate layout only when needed on dynamic keywords
Diffstat (limited to 'src/config/ConfigManager.cpp')
-rw-r--r--src/config/ConfigManager.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 59f28e42..8834aff1 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -983,6 +983,8 @@ std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::
currentCategory = "";
}
+ int needsLayoutRecalc = COMMAND == "monitor"; // 0 - no, 1 - yes, 2 - maybe
+
if (COMMAND == "exec") {
if (isFirstLaunch) {
firstExecRequests.push_back(VALUE);
@@ -1006,16 +1008,22 @@ std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::
else if (COMMAND == "submap") handleSubmap(COMMAND, VALUE);
else if (COMMAND == "blurls") handleBlurLS(COMMAND, VALUE);
else if (COMMAND == "wsbind") handleBindWS(COMMAND, VALUE);
- else
+ else {
configSetValueSafe(currentCategory + (currentCategory == "" ? "" : ":") + COMMAND, VALUE);
+ needsLayoutRecalc = 2;
+ }
if (dynamic) {
std::string retval = parseError;
parseError = "";
- // invalidate layouts jic
- for (auto& m : g_pCompositor->m_vMonitors)
- g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
+ // invalidate layouts if they changed
+ if (needsLayoutRecalc) {
+ if (needsLayoutRecalc == 1 || VALUE.find("gaps_") || VALUE.find("dwindle:") == 0 || VALUE.find("master:") == 0) {
+ for (auto& m : g_pCompositor->m_vMonitors)
+ g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
+ }
+ }
// Update window border colors
g_pCompositor->updateAllWindowsAnimatedDecorationValues();