From c16044a5c88ce9a42987b849068a66c11873575d Mon Sep 17 00:00:00 2001 From: Alexander Iliev Date: Tue, 10 Dec 2024 22:54:51 +0200 Subject: [PATCH] core: Fix workspace selector parsing (#8687) Search for the closing bracket when parsing a workspace selector. This is needed when the `m[desc:]` selector is used, as the monitor description always contains spaces. --- src/desktop/Workspace.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/desktop/Workspace.cpp b/src/desktop/Workspace.cpp index 3bf89ec39..0230262a0 100644 --- a/src/desktop/Workspace.cpp +++ b/src/desktop/Workspace.cpp @@ -275,9 +275,9 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) { // f - fullscreen state : f[-1], f[0], f[1], or f[2] for different fullscreen states // -1: no fullscreen, 0: fullscreen, 1: maximized, 2: fullscreen without sending fs state to window - const auto NEXTSPACE = selector.find_first_of(' ', i); - std::string prop = selector.substr(i, NEXTSPACE == std::string::npos ? std::string::npos : NEXTSPACE - i); - i = std::min(NEXTSPACE, std::string::npos - 1); + const auto CLOSING_BRACKET = selector.find_first_of(']', i); + std::string prop = selector.substr(i, CLOSING_BRACKET == std::string::npos ? std::string::npos : CLOSING_BRACKET + 1 - i); + i = std::min(CLOSING_BRACKET, std::string::npos - 1); if (cur == 'r') { WORKSPACEID from = 0, to = 0;