From 500cbd135f3c928f1b16c13bc5a9f39c966127b5 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 5 May 2022 13:02:55 +0200 Subject: [PATCH] moveactive monitor --- src/managers/KeybindManager.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 0f4d538a..f249fa00 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -367,6 +367,28 @@ void CKeybindManager::moveFocusTo(std::string args) { void CKeybindManager::moveActiveTo(std::string args) { char arg = args[0]; + const auto LASTMONITOR = g_pCompositor->m_pLastMonitor; + + if (args.find("mon:") == 0) { + // hack: save the active window + const auto PACTIVE = g_pCompositor->m_pLastWindow; + + // monitor + focusMonitor(args.substr(4)); + + if (LASTMONITOR == g_pCompositor->m_pLastMonitor) { + Debug::log(ERR, "moveActiveTo: moving to an invalid mon"); + return; + } + + // restore the active + g_pCompositor->focusWindow(PACTIVE); + + moveActiveToWorkspace(std::to_string(g_pCompositor->m_pLastMonitor->activeWorkspace)); + + return; + } + if (!isDirection(args)) { Debug::log(ERR, "Cannot move window in direction %c, unsupported direction. Supported: l,r,u/t,d/b", arg); return;