diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 53c008f9..079d9a8d 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -35,6 +35,7 @@ void CConfigManager::setDefaultVars() { configValues["general:main_mod"].strValue = "SUPER"; // exposed to the user for easier configuring configValues["general:main_mod_internal"].intValue = g_pKeybindManager->stringToModMask("SUPER"); // actually used and automatically calculated configValues["general:workspace_back_and_forth"].intValue = 0; + configValues["general:allow_workspace_cycles"].intValue = 0; configValues["general:damage_tracking"].strValue = "full"; configValues["general:damage_tracking_internal"].intValue = DAMAGE_TRACKING_FULL; diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 45af02a0..ab22d98f 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -476,8 +476,10 @@ void CKeybindManager::changeworkspace(std::string args) { workspaceToChangeTo = P_CURRENT_WORKSPACE->m_iPrevWorkspaceID; isSwitchingToPrevious = true; - // TODO: Add support for cycles - P_CURRENT_WORKSPACE->m_iPrevWorkspaceID = -1; + // If the previous workspace ID isn't reset, cycles can form when continually going + // to the previous workspace again and again. + if (!g_pConfigManager->getConfigValuePtr("general:allow_workspace_cycles")->intValue) + P_CURRENT_WORKSPACE->m_iPrevWorkspaceID = -1; } } else { workspaceToChangeTo = getWorkspaceIDFromString(args, workspaceName); @@ -499,8 +501,10 @@ void CKeybindManager::changeworkspace(std::string args) { workspaceToChangeTo = P_CURRENT_WORKSPACE->m_iPrevWorkspaceID; isSwitchingToPrevious = true; - // TODO: Add support for cycles - P_CURRENT_WORKSPACE->m_iPrevWorkspaceID = -1; + // If the previous workspace ID isn't reset, cycles can form when continually going + // to the previous workspace again and again. + if (!g_pConfigManager->getConfigValuePtr("general:allow_workspace_cycles")->intValue) + P_CURRENT_WORKSPACE->m_iPrevWorkspaceID = -1; } // remove constraints