mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-15 10:43:40 +01:00
Add opposite support to change group
This will allow toggling between horizontal and veritcal layouts for non-tabbed layouts
This commit is contained in:
parent
2acac9b1e1
commit
88267eee85
4 changed files with 24 additions and 5 deletions
|
@ -215,8 +215,9 @@ plugin {
|
|||
- `hy3:makegroup, <h | v | opposite | tab>, [ephemeral | force_ephemeral]` - make a vertical / horizontal split or tab group
|
||||
- `ephemeral` - the group will be removed once it contains only one node. does not affect existing groups.
|
||||
- `force_ephemeral` - same as ephemeral, but converts existing single windows groups.
|
||||
- `hy3:changegroup, <h | v | tab | untab> - change the group the node belongs to, to a different layout
|
||||
- `hy3:changegroup, <h | v | tab | untab | opposite> - change the group the node belongs to, to a different layout
|
||||
- `untab` will untab the group if it was previously tabbed
|
||||
- `opposite` will toggle between horizontal and vertical layouts if the group is not tabbed.
|
||||
- `hy3:changeephemerality, <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
|
||||
|
|
|
@ -765,6 +765,14 @@ void Hy3Layout::untabGroupOnWorkspace(int workspace) {
|
|||
this->untabGroupOn(*node);
|
||||
}
|
||||
|
||||
void Hy3Layout::changeGroupToOppositeOnWorkspace(int workspace) {
|
||||
auto* node = this->getWorkspaceFocusedNode(workspace);
|
||||
|
||||
if (node == nullptr) return;
|
||||
|
||||
this->changeGroupToOppositeOn(*node);
|
||||
}
|
||||
|
||||
void Hy3Layout::changeGroupEphemeralityOnWorkspace(int workspace, bool ephemeral) {
|
||||
auto* node = this->getWorkspaceFocusedNode(workspace);
|
||||
|
||||
|
@ -841,6 +849,16 @@ void Hy3Layout::untabGroupOn(Hy3Node& node) {
|
|||
changeGroupOn(node, group.previous_nontab_layout);
|
||||
}
|
||||
|
||||
void Hy3Layout::changeGroupToOppositeOn(Hy3Node& node) {
|
||||
if (node.parent == nullptr) return;
|
||||
|
||||
auto& group = node.parent->data.as_group;
|
||||
|
||||
if (group.layout == Hy3GroupLayout::Tabbed) return;
|
||||
group.setLayout(group.layout == Hy3GroupLayout::SplitH ? Hy3GroupLayout::SplitV : Hy3GroupLayout::SplitH);
|
||||
node.parent->recalcSizePosRecursive();
|
||||
}
|
||||
|
||||
void Hy3Layout::changeGroupEphemeralityOn(Hy3Node& node, bool ephemeral) {
|
||||
if (node.parent == nullptr) return;
|
||||
|
||||
|
|
|
@ -92,11 +92,13 @@ public:
|
|||
void makeOppositeGroupOnWorkspace(int workspace, GroupEphemeralityOption);
|
||||
void changeGroupOnWorkspace(int workspace, Hy3GroupLayout);
|
||||
void untabGroupOnWorkspace(int workspace);
|
||||
void changeGroupToOppositeOnWorkspace(int workspace);
|
||||
void changeGroupEphemeralityOnWorkspace(int workspace, bool ephemeral);
|
||||
void makeGroupOn(Hy3Node*, Hy3GroupLayout, GroupEphemeralityOption);
|
||||
void makeOppositeGroupOn(Hy3Node*, GroupEphemeralityOption);
|
||||
void changeGroupOn(Hy3Node&, Hy3GroupLayout);
|
||||
void untabGroupOn(Hy3Node&);
|
||||
void changeGroupToOppositeOn(Hy3Node&);
|
||||
void changeGroupEphemeralityOn(Hy3Node&, bool ephemeral);
|
||||
void shiftWindow(int workspace, ShiftDirection, bool once);
|
||||
void shiftFocus(int workspace, ShiftDirection, bool visible);
|
||||
|
|
|
@ -57,11 +57,9 @@ void dispatch_changegroup(std::string value) {
|
|||
g_Hy3Layout->changeGroupOnWorkspace(workspace, Hy3GroupLayout::Tabbed);
|
||||
} else if (args[0] == "untab") {
|
||||
g_Hy3Layout->untabGroupOnWorkspace(workspace);
|
||||
} else if (args[0] == "opposite") {
|
||||
g_Hy3Layout->changeGroupToOppositeOnWorkspace(workspace);
|
||||
}
|
||||
// TODO
|
||||
//else if (args[0] == "opposite") {
|
||||
// g_Hy3Layout->makeOppositeGroupOnWorkspace(workspace, ephemeral);
|
||||
//}
|
||||
}
|
||||
|
||||
void dispatch_changeephemerality(std::string value) {
|
||||
|
|
Loading…
Add table
Reference in a new issue