summaryrefslogtreecommitdiff
path: root/src/managers/KeybindManager.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-05 13:02:55 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-05 13:02:55 +0200
commit500cbd135f3c928f1b16c13bc5a9f39c966127b5 (patch)
treea32710a777fa815da6eab07455c0d1c34acf4c4c /src/managers/KeybindManager.cpp
parent8bb908a8da3be119cc64552d4fe8a23cdfb938b8 (diff)
moveactive monitor
Diffstat (limited to 'src/managers/KeybindManager.cpp')
-rw-r--r--src/managers/KeybindManager.cpp22
1 files changed, 22 insertions, 0 deletions
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;