Add togglesplit

This commit is contained in:
outfoxxed 2023-04-27 23:21:23 -07:00
parent ec783b0480
commit 38f7b4f095
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
2 changed files with 21 additions and 1 deletions

View file

@ -959,6 +959,26 @@ void Hy3Layout::fullscreenRequestForWindow(CWindow* window, eFullscreenMode full
}
std::any Hy3Layout::layoutMessage(SLayoutMessageHeader header, std::string content) {
if (content == "togglesplit") {
auto* node = this->getNodeFromWindow(header.pWindow);
if (node != nullptr && node->parent != nullptr) {
auto& layout = node->parent->data.as_group.layout;
switch (layout) {
case Hy3GroupLayout::SplitH:
layout = Hy3GroupLayout::SplitV;
node->parent->recalcSizePosRecursive();
break;
case Hy3GroupLayout::SplitV:
layout = Hy3GroupLayout::SplitH;
node->parent->recalcSizePosRecursive();
break;
case Hy3GroupLayout::Tabbed:
break;
}
}
}
return "";
}

View file

@ -35,7 +35,7 @@ void setup_selection_hook() {
return;
}
g_LastSelectionHook = HyprlandAPI::createFunctionHook(PHANDLE, decoUpdateCandidates[0].address, (void *)&hook_update_decos);
g_LastSelectionHook = HyprlandAPI::createFunctionHook(PHANDLE, decoUpdateCandidates[0].address, (void*)&hook_update_decos);
}
g_LastSelectionHook->hook();