mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-15 18:53:40 +01:00
Add visible
option to movewindow
Allows movement between only visible nodes, skipping all hidden tab groups
This commit is contained in:
parent
6c20af2cfd
commit
0cc5af9e60
4 changed files with 31 additions and 7 deletions
|
@ -222,8 +222,9 @@ plugin {
|
|||
- `hy3:setephemeral, <true | false>` - change the ephemerality of the group the node belongs to
|
||||
- `hy3:movefocus, <l | u | d | r | left | down | up | right>, [visible]` - move the focus left, up, down, or right
|
||||
- `visible` - only move between visible nodes, not hidden tabs
|
||||
- `hy3:movewindow, <l | u | d | r | left | down | up | right>, [once]` - move a window left, up, down, or right
|
||||
- `hy3:movewindow, <l | u | d | r | left | down | up | right>, [once], [visible]` - move a window left, up, down, or right
|
||||
- `once` - only move directly to the neighboring group, without moving into any of its subgroups
|
||||
- `visible` - only move between visible nodes, not hidden tabs
|
||||
- `hy3:killactive` - close all windows in the focused node
|
||||
- `hy3:changefocus, <top | bottom | raise | lower | tab | tabnode>`
|
||||
- `top` - focus all nodes in the workspace
|
||||
|
|
|
@ -874,7 +874,7 @@ void Hy3Layout::changeGroupEphemeralityOn(Hy3Node& node, bool ephemeral) {
|
|||
);
|
||||
}
|
||||
|
||||
void Hy3Layout::shiftWindow(int workspace, ShiftDirection direction, bool once) {
|
||||
void Hy3Layout::shiftWindow(int workspace, ShiftDirection direction, bool once, bool visible) {
|
||||
auto* node = this->getWorkspaceFocusedNode(workspace);
|
||||
Debug::log(LOG, "ShiftWindow %p %d", node, direction);
|
||||
if (node == nullptr) return;
|
||||
|
@ -890,7 +890,7 @@ void Hy3Layout::shiftWindow(int workspace, ShiftDirection direction, bool once)
|
|||
node2->recalcSizePosRecursive();
|
||||
}
|
||||
} else {
|
||||
this->shiftOrGetFocus(*node, direction, true, once, false);
|
||||
this->shiftOrGetFocus(*node, direction, true, once, visible);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1584,7 +1584,17 @@ Hy3Node* Hy3Layout::shiftOrGetFocus(
|
|||
group_data.children.end(),
|
||||
group_data.focused_child
|
||||
);
|
||||
} else if (shiftMatchesLayout(group_data.layout, direction)) {
|
||||
} else if (visible && group_data.layout == Hy3GroupLayout::Tabbed && group_data.focused_child != nullptr)
|
||||
{
|
||||
// if the group is tabbed and we're going by visible nodes, jump to the current entry
|
||||
iter = std::find(
|
||||
group_data.children.begin(),
|
||||
group_data.children.end(),
|
||||
group_data.focused_child
|
||||
);
|
||||
shift_after = true;
|
||||
} else if (shiftMatchesLayout(group_data.layout, direction) || (visible && group_data.layout == Hy3GroupLayout::Tabbed))
|
||||
{
|
||||
// if the group has the same orientation as movement pick the
|
||||
// last/first child based on movement direction
|
||||
if (shiftIsForward(direction)) iter = group_data.children.begin();
|
||||
|
|
|
@ -102,7 +102,7 @@ public:
|
|||
void toggleTabGroupOn(Hy3Node&);
|
||||
void changeGroupToOppositeOn(Hy3Node&);
|
||||
void changeGroupEphemeralityOn(Hy3Node&, bool ephemeral);
|
||||
void shiftWindow(int workspace, ShiftDirection, bool once);
|
||||
void shiftWindow(int workspace, ShiftDirection, bool once, bool visible);
|
||||
void shiftFocus(int workspace, ShiftDirection, bool visible);
|
||||
void changeFocus(int workspace, FocusShift);
|
||||
void focusTab(int workspace, TabFocus target, TabFocusMousePriority, bool wrap_scroll, int index);
|
||||
|
|
|
@ -90,8 +90,21 @@ void dispatch_movewindow(std::string value) {
|
|||
auto args = CVarList(value);
|
||||
|
||||
if (auto shift = parseShiftArg(args[0])) {
|
||||
auto once = args[1] == "once";
|
||||
g_Hy3Layout->shiftWindow(workspace, shift.value(), once);
|
||||
int i = 1;
|
||||
bool once = false;
|
||||
bool visible = false;
|
||||
|
||||
if (args[i] == "once") {
|
||||
once = true;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (args[i] == "visible") {
|
||||
visible = true;
|
||||
i++;
|
||||
}
|
||||
|
||||
g_Hy3Layout->shiftWindow(workspace, shift.value(), once, visible);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue