summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEmad Elsaid <54403+emad-elsaid@users.noreply.github.com>2025-03-30 03:12:15 +0200
committerGitHub <noreply@github.com>2025-03-30 03:12:15 +0200
commitda2d7c3971d40f841f2afd7def8e4bad9a351e41 (patch)
treef618697f8d39c6064c53eee0d642b6c70cdb9d1d /src
parent05eb0aa43ded10f008be3cfcde33fe0bfe6e45b1 (diff)
config: Fix matching monitor by description to allow space prefix (#9788)
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigManager.cpp8
-rw-r--r--src/helpers/Monitor.cpp2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index b32a2d03..276e6db0 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -1707,8 +1707,8 @@ void CConfigManager::addParseError(const std::string& err) {
PHLMONITOR CConfigManager::getBoundMonitorForWS(const std::string& wsname) {
auto monitor = getBoundMonitorStringForWS(wsname);
- if (monitor.substr(0, 5) == "desc:")
- return g_pCompositor->getMonitorFromDesc(monitor.substr(5));
+ if (monitor.starts_with("desc:"))
+ return g_pCompositor->getMonitorFromDesc(trim(monitor.substr(5)));
else
return g_pCompositor->getMonitorFromName(monitor);
}
@@ -1798,8 +1798,8 @@ std::string CConfigManager::getDefaultWorkspaceFor(const std::string& name) {
if (other->isDefault) {
if (other->monitor == name)
return other->workspaceString;
- if (other->monitor.substr(0, 5) == "desc:") {
- auto const monitor = g_pCompositor->getMonitorFromDesc(other->monitor.substr(5));
+ if (other->monitor.starts_with("desc:")) {
+ auto const monitor = g_pCompositor->getMonitorFromDesc(trim(other->monitor.substr(5)));
if (monitor && monitor->szName == name)
return other->workspaceString;
}
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp
index 75c0d8b9..98f45cce 100644
--- a/src/helpers/Monitor.cpp
+++ b/src/helpers/Monitor.cpp
@@ -881,7 +881,7 @@ bool CMonitor::isMirror() {
bool CMonitor::matchesStaticSelector(const std::string& selector) const {
if (selector.starts_with("desc:")) {
// match by description
- const auto DESCRIPTIONSELECTOR = selector.substr(5);
+ const auto DESCRIPTIONSELECTOR = trim(selector.substr(5));
return szDescription.starts_with(DESCRIPTIONSELECTOR) || szShortDescription.starts_with(DESCRIPTIONSELECTOR);
} else {