summaryrefslogtreecommitdiff
path: root/src/managers/KeybindManager.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-07-06 11:02:21 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-07-06 11:02:21 +0200
commit239aa2cec4373f45ca55be74d5768b42abf1e749 (patch)
tree5a9e512ac04409dd2d2ee2d51993bc4dc21749a2 /src/managers/KeybindManager.cpp
parentae096219e83b1a90990f2277b5a9302a3e943d84 (diff)
fix internal workspace changes being clamped
Diffstat (limited to 'src/managers/KeybindManager.cpp')
-rw-r--r--src/managers/KeybindManager.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 4ecf792e..f5ec0e48 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -253,7 +253,14 @@ void CKeybindManager::changeworkspace(std::string args) {
int workspaceToChangeTo = 0;
std::string workspaceName = "";
- workspaceToChangeTo = getWorkspaceIDFromString(args, workspaceName);
+ if (args.find("[internal]") == 0) {
+ workspaceToChangeTo = std::stoi(args.substr(10));
+ const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceToChangeTo);
+ if (PWORKSPACE)
+ workspaceName = PWORKSPACE->m_szName;
+ } else {
+ workspaceToChangeTo = getWorkspaceIDFromString(args, workspaceName);
+ }
if (workspaceToChangeTo == INT_MAX) {
Debug::log(ERR, "Error in changeworkspace, invalid value");
@@ -451,7 +458,7 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
// undo the damage if we are moving to the special workspace
if (WORKSPACEID == SPECIAL_WORKSPACE_ID) {
- changeworkspace(std::to_string(OLDWORKSPACE->m_iID));
+ changeworkspace("[internal]" + std::to_string(OLDWORKSPACE->m_iID));
OLDWORKSPACE->startAnim(true, true, true);
toggleSpecialWorkspace("");
g_pCompositor->getWorkspaceByID(SPECIAL_WORKSPACE_ID)->startAnim(false, false, true);
@@ -503,8 +510,8 @@ void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
PWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceToMoveTo);
- changeworkspace(std::to_string(OLDWORKSPACEIDONMONITOR));
- changeworkspace(std::to_string(OLDWORKSPACEIDRETURN));
+ changeworkspace("[internal]" + std::to_string(OLDWORKSPACEIDONMONITOR));
+ changeworkspace("[internal]" + std::to_string(OLDWORKSPACEIDRETURN));
// revert animations
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(0,0));
@@ -663,7 +670,7 @@ void CKeybindManager::focusMonitor(std::string arg) {
}
if (monID > -1 && monID < (int)g_pCompositor->m_vMonitors.size()) {
- changeworkspace(std::to_string(g_pCompositor->getMonitorFromID(monID)->activeWorkspace));
+ changeworkspace("[internal]" + std::to_string(g_pCompositor->getMonitorFromID(monID)->activeWorkspace));
} else {
Debug::log(ERR, "Error in focusMonitor: invalid arg 1");
}
@@ -683,7 +690,7 @@ void CKeybindManager::focusMonitor(std::string arg) {
} else {
for (auto& m : g_pCompositor->m_vMonitors) {
if (m->szName == arg) {
- changeworkspace(std::to_string(m->activeWorkspace));
+ changeworkspace("[internal]" + std::to_string(m->activeWorkspace));
return;
}
}
@@ -1051,7 +1058,7 @@ void CKeybindManager::focusWindow(std::string regexp) {
Debug::log(LOG, "Focusing to window name: %s", w->m_szTitle.c_str());
- changeworkspace(std::to_string(w->m_iWorkspaceID));
+ changeworkspace("[internal]" + std::to_string(w->m_iWorkspaceID));
g_pCompositor->focusWindow(w.get());