mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-16 03:03:40 +01:00
Add changeephemerality dispatcher
This commit is contained in:
parent
8b12921939
commit
2acac9b1e1
4 changed files with 28 additions and 0 deletions
|
@ -217,6 +217,7 @@ plugin {
|
|||
- `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
|
||||
- `untab` will untab the group if it was previously 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
|
||||
- `hy3:movewindow, <l | u | d | r | left | down | up | right>, [once]` - move a window left, up, down, or right
|
||||
|
|
|
@ -765,6 +765,14 @@ void Hy3Layout::untabGroupOnWorkspace(int workspace) {
|
|||
this->untabGroupOn(*node);
|
||||
}
|
||||
|
||||
void Hy3Layout::changeGroupEphemeralityOnWorkspace(int workspace, bool ephemeral) {
|
||||
auto* node = this->getWorkspaceFocusedNode(workspace);
|
||||
|
||||
if (node == nullptr) return;
|
||||
|
||||
this->changeGroupEphemeralityOn(*node, ephemeral);
|
||||
}
|
||||
|
||||
void Hy3Layout::makeGroupOn(
|
||||
Hy3Node* node,
|
||||
Hy3GroupLayout layout,
|
||||
|
@ -831,8 +839,13 @@ void Hy3Layout::untabGroupOn(Hy3Node& node) {
|
|||
if (group.layout != Hy3GroupLayout::Tabbed) return;
|
||||
|
||||
changeGroupOn(node, group.previous_nontab_layout);
|
||||
}
|
||||
|
||||
void Hy3Layout::changeGroupEphemeralityOn(Hy3Node& node, bool ephemeral) {
|
||||
if (node.parent == nullptr) return;
|
||||
|
||||
auto& group = node.parent->data.as_group;
|
||||
group.setEphemeral(ephemeral ? GroupEphemeralityOption::ForceEphemeral : GroupEphemeralityOption::Standard);
|
||||
}
|
||||
|
||||
void Hy3Layout::shiftWindow(int workspace, ShiftDirection direction, bool once) {
|
||||
|
|
|
@ -92,10 +92,12 @@ public:
|
|||
void makeOppositeGroupOnWorkspace(int workspace, GroupEphemeralityOption);
|
||||
void changeGroupOnWorkspace(int workspace, Hy3GroupLayout);
|
||||
void untabGroupOnWorkspace(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 changeGroupEphemeralityOn(Hy3Node&, bool ephemeral);
|
||||
void shiftWindow(int workspace, ShiftDirection, bool once);
|
||||
void shiftFocus(int workspace, ShiftDirection, bool visible);
|
||||
void changeFocus(int workspace, FocusShift);
|
||||
|
|
|
@ -64,6 +64,17 @@ void dispatch_changegroup(std::string value) {
|
|||
//}
|
||||
}
|
||||
|
||||
void dispatch_changeephemerality(std::string value) {
|
||||
int workspace = workspace_for_action();
|
||||
if (workspace == -1) return;
|
||||
|
||||
auto args = CVarList(value);
|
||||
|
||||
bool ephemeral = args[0] == "true";
|
||||
|
||||
g_Hy3Layout->changeGroupEphemeralityOnWorkspace(workspace, ephemeral);
|
||||
}
|
||||
|
||||
|
||||
std::optional<ShiftDirection> parseShiftArg(std::string arg) {
|
||||
if (arg == "l" || arg == "left") return ShiftDirection::Left;
|
||||
|
@ -211,6 +222,7 @@ void dispatch_debug(std::string arg) {
|
|||
void registerDispatchers() {
|
||||
HyprlandAPI::addDispatcher(PHANDLE, "hy3:makegroup", dispatch_makegroup);
|
||||
HyprlandAPI::addDispatcher(PHANDLE, "hy3:changegroup", dispatch_changegroup);
|
||||
HyprlandAPI::addDispatcher(PHANDLE, "hy3:changeephemerality", dispatch_changeephemerality);
|
||||
HyprlandAPI::addDispatcher(PHANDLE, "hy3:movefocus", dispatch_movefocus);
|
||||
HyprlandAPI::addDispatcher(PHANDLE, "hy3:movewindow", dispatch_movewindow);
|
||||
HyprlandAPI::addDispatcher(PHANDLE, "hy3:changefocus", dispatch_changefocus);
|
||||
|
|
Loading…
Add table
Reference in a new issue