mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-15 18:53:40 +01:00
Add option to create a tab group for the first spawned window
This commit is contained in:
parent
0862855b87
commit
1222764a7c
3 changed files with 21 additions and 0 deletions
|
@ -181,6 +181,9 @@ plugin {
|
||||||
# offset from group split direction when only one window is in a group
|
# offset from group split direction when only one window is in a group
|
||||||
group_inset = <int> # default: 10
|
group_inset = <int> # default: 10
|
||||||
|
|
||||||
|
# if a tab group will automatically be created for the first window spawned in a workspace
|
||||||
|
tab_first_window = <bool>
|
||||||
|
|
||||||
# tab group settings
|
# tab group settings
|
||||||
tabs {
|
tabs {
|
||||||
# height of the tab bar
|
# height of the tab bar
|
||||||
|
|
|
@ -130,6 +130,8 @@ void Hy3Layout::onWindowCreatedTiling(CWindow* window, eDirection) {
|
||||||
opening_into = opening_after->parent;
|
opening_into = opening_after->parent;
|
||||||
} else {
|
} else {
|
||||||
if ((opening_into = this->getWorkspaceRootGroup(window->m_iWorkspaceID)) == nullptr) {
|
if ((opening_into = this->getWorkspaceRootGroup(window->m_iWorkspaceID)) == nullptr) {
|
||||||
|
static const auto* tab_first_window = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tab_first_window")->intValue;
|
||||||
|
|
||||||
this->nodes.push_back({
|
this->nodes.push_back({
|
||||||
.data = Hy3GroupLayout::SplitH,
|
.data = Hy3GroupLayout::SplitH,
|
||||||
.position = monitor->vecPosition + monitor->vecReservedTopLeft,
|
.position = monitor->vecPosition + monitor->vecReservedTopLeft,
|
||||||
|
@ -138,6 +140,21 @@ void Hy3Layout::onWindowCreatedTiling(CWindow* window, eDirection) {
|
||||||
.layout = this,
|
.layout = this,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (*tab_first_window) {
|
||||||
|
auto& parent = this->nodes.back();
|
||||||
|
|
||||||
|
this->nodes.push_back({
|
||||||
|
.parent = &parent,
|
||||||
|
.data = Hy3GroupLayout::Tabbed,
|
||||||
|
.position = parent.position,
|
||||||
|
.size = parent.size,
|
||||||
|
.workspace_id = window->m_iWorkspaceID,
|
||||||
|
.layout = this,
|
||||||
|
});
|
||||||
|
|
||||||
|
parent.data.as_group.children.push_back(&this->nodes.back());
|
||||||
|
}
|
||||||
|
|
||||||
opening_into = &this->nodes.back();
|
opening_into = &this->nodes.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
|
||||||
CONF("no_gaps_when_only", int, 0);
|
CONF("no_gaps_when_only", int, 0);
|
||||||
CONF("node_collapse_policy", int, 2);
|
CONF("node_collapse_policy", int, 2);
|
||||||
CONF("group_inset", int, 10);
|
CONF("group_inset", int, 10);
|
||||||
|
CONF("tab_first_window", int, 0);
|
||||||
|
|
||||||
// tabs
|
// tabs
|
||||||
CONF("tabs:height", int, 15);
|
CONF("tabs:height", int, 15);
|
||||||
|
|
Loading…
Add table
Reference in a new issue