diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-11-27 22:42:22 +0000 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-11-27 22:42:22 +0000 |
| commit | 0a302901d26eff02a83742aa319f20f3b3a0c372 (patch) | |
| tree | 2104ba94ae9279ef0ed8a0c3edb861564099e6a1 /src/helpers/MiscFunctions.cpp | |
| parent | 49063f949df92ab60244ff9e08025172bc512a8d (diff) | |
Added handling more special workspaces
Diffstat (limited to 'src/helpers/MiscFunctions.cpp')
| -rw-r--r-- | src/helpers/MiscFunctions.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp index 37828c5d..5f2aae6a 100644 --- a/src/helpers/MiscFunctions.cpp +++ b/src/helpers/MiscFunctions.cpp @@ -234,7 +234,18 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) { int result = INT_MAX; if (in.find("special") == 0) { outName = "special"; - return SPECIAL_WORKSPACE_ID; + + if (in.length() > 8) { + const auto NAME = in.substr(8); + + const auto WS = g_pCompositor->getWorkspaceByName("special:" + NAME); + + outName = "special:" + NAME; + + return WS ? WS->m_iID : g_pCompositor->getNewSpecialID(); + } + + return SPECIAL_WORKSPACE_START; } else if (in.find("name:") == 0) { const auto WORKSPACENAME = in.substr(in.find_first_of(':') + 1); const auto WORKSPACE = g_pCompositor->getWorkspaceByName(WORKSPACENAME); @@ -281,7 +292,7 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) { int highestID = -99999; for (auto& w : g_pCompositor->m_vWorkspaces) { - if (w->m_iID == SPECIAL_WORKSPACE_ID) + if (g_pCompositor->isWorkspaceSpecial(w->m_iID)) continue; if (w->m_iID < lowestID) @@ -297,7 +308,7 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) { searchID = lowestID; } - if (const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(searchID); PWORKSPACE && PWORKSPACE->m_iID != SPECIAL_WORKSPACE_ID) { + if (const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(searchID); PWORKSPACE && !PWORKSPACE->m_bIsSpecialWorkspace) { if (onAllMonitors || PWORKSPACE->m_iMonitorID == g_pCompositor->m_pLastMonitor->ID) { currentID = PWORKSPACE->m_iID; |
