Diff
1diff --git a/README.md b/README.md
2index 74004ad365e9c1e86e2ea4d47c8a57512cde91be..e04bf79774649ab862b3df182d5b257364059909 100644
3--- a/README.md
4+++ b/README.md
5@@ -222,8 +222,9 @@ plugin {
6 - `hy3:setephemeral, <true | false>` - change the ephemerality of the group the node belongs to
7 - `hy3:movefocus, <l | u | d | r | left | down | up | right>, [visible]` - move the focus left, up, down, or right
8 - `visible` - only move between visible nodes, not hidden tabs
9- - `hy3:movewindow, <l | u | d | r | left | down | up | right>, [once]` - move a window left, up, down, or right
10+ - `hy3:movewindow, <l | u | d | r | left | down | up | right>, [once], [visible]` - move a window left, up, down, or right
11 - `once` - only move directly to the neighboring group, without moving into any of its subgroups
12+ - `visible` - only move between visible nodes, not hidden tabs
13 - `hy3:killactive` - close all windows in the focused node
14 - `hy3:changefocus, <top | bottom | raise | lower | tab | tabnode>`
15 - `top` - focus all nodes in the workspace
16diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
17index 7564abecd64b1d3fef404a34f18a8151ea539573..12a67ab80b2f966f09539d946661a62e17dfc1b7 100644
18--- a/src/Hy3Layout.cpp
19+++ b/src/Hy3Layout.cpp
20@@ -874,7 +874,7 @@ void Hy3Layout::changeGroupEphemeralityOn(Hy3Node& node, bool ephemeral) {
21 );
22 }
23
24-void Hy3Layout::shiftWindow(int workspace, ShiftDirection direction, bool once) {
25+void Hy3Layout::shiftWindow(int workspace, ShiftDirection direction, bool once, bool visible) {
26 auto* node = this->getWorkspaceFocusedNode(workspace);
27 Debug::log(LOG, "ShiftWindow %p %d", node, direction);
28 if (node == nullptr) return;
29@@ -890,7 +890,7 @@ void Hy3Layout::shiftWindow(int workspace, ShiftDirection direction, bool once)
30 node2->recalcSizePosRecursive();
31 }
32 } else {
33- this->shiftOrGetFocus(*node, direction, true, once, false);
34+ this->shiftOrGetFocus(*node, direction, true, once, visible);
35 }
36 }
37
38@@ -1584,7 +1584,17 @@ Hy3Node* Hy3Layout::shiftOrGetFocus(
39 group_data.children.end(),
40 group_data.focused_child
41 );
42- } else if (shiftMatchesLayout(group_data.layout, direction)) {
43+ } else if (visible && group_data.layout == Hy3GroupLayout::Tabbed && group_data.focused_child != nullptr)
44+ {
45+ // if the group is tabbed and we're going by visible nodes, jump to the current entry
46+ iter = std::find(
47+ group_data.children.begin(),
48+ group_data.children.end(),
49+ group_data.focused_child
50+ );
51+ shift_after = true;
52+ } else if (shiftMatchesLayout(group_data.layout, direction) || (visible && group_data.layout == Hy3GroupLayout::Tabbed))
53+ {
54 // if the group has the same orientation as movement pick the
55 // last/first child based on movement direction
56 if (shiftIsForward(direction)) iter = group_data.children.begin();
57diff --git a/src/Hy3Layout.hpp b/src/Hy3Layout.hpp
58index d6728e2920940844a8f8663a9e8dac6f015710f7..83f81c7b600b2d4eba0b71e3d02a05cb60d589e9 100644
59--- a/src/Hy3Layout.hpp
60+++ b/src/Hy3Layout.hpp
61@@ -102,7 +102,7 @@ public:
62 void toggleTabGroupOn(Hy3Node&);
63 void changeGroupToOppositeOn(Hy3Node&);
64 void changeGroupEphemeralityOn(Hy3Node&, bool ephemeral);
65- void shiftWindow(int workspace, ShiftDirection, bool once);
66+ void shiftWindow(int workspace, ShiftDirection, bool once, bool visible);
67 void shiftFocus(int workspace, ShiftDirection, bool visible);
68 void changeFocus(int workspace, FocusShift);
69 void focusTab(int workspace, TabFocus target, TabFocusMousePriority, bool wrap_scroll, int index);
70diff --git a/src/dispatchers.cpp b/src/dispatchers.cpp
71index f56b2fb2c5cc9b4ffc8fc20e3f3e19dad28a266f..a1a6da1007608f0dd41881e0dd1b12f5412cf9a7 100644
72--- a/src/dispatchers.cpp
73+++ b/src/dispatchers.cpp
74@@ -90,8 +90,21 @@ void dispatch_movewindow(std::string value) {
75 auto args = CVarList(value);
76
77 if (auto shift = parseShiftArg(args[0])) {
78- auto once = args[1] == "once";
79- g_Hy3Layout->shiftWindow(workspace, shift.value(), once);
80+ int i = 1;
81+ bool once = false;
82+ bool visible = false;
83+
84+ if (args[i] == "once") {
85+ once = true;
86+ i++;
87+ }
88+
89+ if (args[i] == "visible") {
90+ visible = true;
91+ i++;
92+ }
93+
94+ g_Hy3Layout->shiftWindow(workspace, shift.value(), once, visible);
95 }
96 }
97