From 4cc0e6de90844dd340108f132db014ccf8d44ba7 Mon Sep 17 00:00:00 2001 From: MightyPlaza <123664421+MightyPlaza@users.noreply.github.com> Date: Mon, 10 Jul 2023 05:53:03 +0000 Subject: [PATCH] monitor desc default workspace (#2673) --- src/config/ConfigManager.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index e6894865..7bdd3ae7 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -2183,8 +2183,10 @@ void CConfigManager::removePluginConfig(HANDLE handle) { } std::string CConfigManager::getDefaultWorkspaceFor(const std::string& name) { - const auto IT = std::find_if(m_dWorkspaceRules.begin(), m_dWorkspaceRules.end(), [&](const auto& other) { return other.monitor == name && other.isDefault; }); - if (IT == m_dWorkspaceRules.end()) - return ""; - return IT->workspaceString; + for (auto other = m_dWorkspaceRules.begin(); other != m_dWorkspaceRules.end(); ++other) { + if (other->isDefault && + (other->monitor == name || (other->monitor.substr(0, 5) == "desc:" && g_pCompositor->getMonitorFromDesc(other->monitor.substr(5))->szName == name))) + return other->workspaceString; + } + return ""; }