Diff
1diff --git a/CHANGELOG.md b/CHANGELOG.md
2index dcda93ed108d5ddd57d6726d4f036e9002e339f3..7fccd078a2224344106e6c9d7faab5ef8ff23734 100644
3--- a/CHANGELOG.md
4+++ b/CHANGELOG.md
5@@ -7,6 +7,8 @@
6 - Changed default tab style.
7 - Fixed floating windows losing their size after maximizing and then going into fullscreen.
8 - Fixed tab bars being clickable while covered by layers or with active pointer grabs.
9+- Fixed bugs when moving nodes across workspaces.
10+- Added warp option to `hy3:movetoworkspace`.
11
12 # hl0.46.0 and before
13
14diff --git a/README.md b/README.md
15index 25232cda4cd93d637380c1588f3ad2dd846cb18c..57dfef4ac7c44497b6fea48dcafe36dcfc520870 100644
16--- a/README.md
17+++ b/README.md
18@@ -337,8 +337,10 @@ plugin {
19 - `hy3:movewindow, <l | u | d | r | left | down | up | right>, [once], [visible]` - move a window left, up, down, or right
20 - `once` - only move directly to the neighboring group, without moving into any of its subgroups
21 - `visible` - only move between visible nodes, not hidden tabs
22- - `hy3:movetoworkspace, <workspace>, [follow]` - move the active node to the given workspace
23+ - `hy3:movetoworkspace, <workspace>, [follow, [warp | nowarp]]` - move the active node to the given workspace
24 - `follow` - change focus to the given workspace when moving the selected node
25+ - `warp` - warp the mouse to the selected window, even if `general:no_cursor_warps` is true.
26+ - `nowarp` - does not warp the mouse to the selected window, even if `general:no_cursor_warps` is false.
27 - `hy3:killactive` - close all windows in the focused node
28 - `hy3:changefocus, <top | bottom | raise | lower | tab | tabnode>`
29 - `top` - focus all nodes in the workspace
30diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
31index 3ed7a8df353c8a7b58dde279c9c45db583e95f33..8d00f61978748f0fb6d4aa46339e717d72c1cb76 100644
32--- a/src/Hy3Layout.cpp
33+++ b/src/Hy3Layout.cpp
34@@ -988,7 +988,7 @@ bool Hy3Layout::shiftMonitor(Hy3Node& node, ShiftDirection direction, bool follo
35 g_pCompositor->setActiveMonitor(next_monitor);
36 auto next_workspace = next_monitor->activeWorkspace;
37 if (next_workspace) {
38- moveNodeToWorkspace(node.workspace, next_workspace->m_szName, follow);
39+ moveNodeToWorkspace(node.workspace, next_workspace->m_szName, follow, false);
40 return true;
41 }
42 }
43@@ -1049,7 +1049,7 @@ void changeNodeWorkspaceRecursive(Hy3Node& node, const PHLWORKSPACE& workspace)
44 }
45 }
46
47-void Hy3Layout::moveNodeToWorkspace(const PHLWORKSPACE& origin, std::string wsname, bool follow) {
48+void Hy3Layout::moveNodeToWorkspace(const PHLWORKSPACE& origin, std::string wsname, bool follow, bool warp) {
49 auto target = getWorkspaceIDNameFromString(operationWorkspaceForName(wsname));
50
51 if (target.id == WORKSPACE_INVALID) {
52@@ -1114,11 +1114,14 @@ void Hy3Layout::moveNodeToWorkspace(const PHLWORKSPACE& origin, std::string wsna
53 origin_ws->m_pMonitor->setSpecialWorkspace(nullptr);
54 }
55
56- monitor->changeWorkspace(workspace);
57-
58 static const auto allow_workspace_cycles =
59 ConfigValue<Hyprlang::INT>("binds:allow_workspace_cycles");
60+
61+ monitor->changeWorkspace(workspace);
62 if (*allow_workspace_cycles) workspace->rememberPrevWorkspace(origin_ws);
63+
64+ node->parent->recalcSizePosRecursive();
65+ node->focus(warp);
66 }
67 }
68
69diff --git a/src/Hy3Layout.hpp b/src/Hy3Layout.hpp
70index 3fd9c2e3e242b5e304e60c2fa49eb5fefd01cc83..54937d6715594445dd3099d3ff72da3c3bbf5416 100644
71--- a/src/Hy3Layout.hpp
72+++ b/src/Hy3Layout.hpp
73@@ -126,7 +126,7 @@ public:
74 Hy3Node* focusMonitor(ShiftDirection);
75
76 void warpCursor();
77- void moveNodeToWorkspace(const PHLWORKSPACE& origin, std::string wsname, bool follow);
78+ void moveNodeToWorkspace(const PHLWORKSPACE& origin, std::string wsname, bool follow, bool warp);
79 void changeFocus(const PHLWORKSPACE& workspace, FocusShift);
80 void focusTab(
81 const PHLWORKSPACE& workspace,
82diff --git a/src/dispatchers.cpp b/src/dispatchers.cpp
83index 6eab8888884e0a807a5390781fef84a3da3e1305..e7fc74d6c254ae950f6408f33ec454a0bd850637 100644
84--- a/src/dispatchers.cpp
85+++ b/src/dispatchers.cpp
86@@ -150,12 +150,18 @@ void dispatch_move_to_workspace(std::string value) {
87
88 auto args = CVarList(value);
89
90+ static const auto no_cursor_warps = ConfigValue<Hyprlang::INT>("cursor:no_warps");
91+
92 auto workspace = args[0];
93 if (workspace == "") return;
94
95- bool follow = args[1] == "follow";
96+ auto follow = args[1] == "follow";
97+
98+ auto warp_cursor =
99+ follow
100+ && ((!*no_cursor_warps && args[2] != "nowarp") || (*no_cursor_warps && args[2] == "warp"));
101
102- g_Hy3Layout->moveNodeToWorkspace(origin_workspace, workspace, follow);
103+ g_Hy3Layout->moveNodeToWorkspace(origin_workspace, workspace, follow, warp_cursor);
104 }
105
106 void dispatch_changefocus(std::string arg) {