c74b108c295a2083a5cb12ca4e8d8098b1526a9a

Author
outfoxxed <outfoxxed@outfoxxed.me>
Committer
outfoxxed <outfoxxed@outfoxxed.me>
Date

Message

Fix missing group inset

Diff

 1diff --git a/README.md b/README.md
 2index cf3dc6238918525c03060182b8bd21e8a7248500..c1eed0c24ab4fd6297628a1b26aeacd683f6d149 100644
 3--- a/README.md
 4+++ b/README.md
 5@@ -38,6 +38,9 @@ plugin {
 6     # disable gaps when only one window is onscreen
 7     no_gaps_when_only = <bool>
 8 
 9+    # offset from group split direction when only one window is in a group
10+    group_inset = <int>
11+
12     # tab group settings
13     tabs {
14       # height of the tab bar
15diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
16index 80d2d10b93a4c66f7b9e47ac6e2725d24438526c..b9a5492333298282e56c1115d702a7ea02b62e0d 100644
17--- a/src/Hy3Layout.cpp
18+++ b/src/Hy3Layout.cpp
19@@ -112,6 +112,7 @@ bool Hy3Node::operator==(const Hy3Node& rhs) const {
20 void Hy3Node::recalcSizePosRecursive(bool force) {
21 	static const auto* gaps_in = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_in")->intValue;
22 	static const auto* gaps_out = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_out")->intValue;
23+	static const auto* group_inset = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:group_inset")->intValue;
24 
25 	int outer_gaps = 0;
26 	Vector2D gap_pos_offset;
27@@ -151,9 +152,16 @@ void Hy3Node::recalcSizePosRecursive(bool force) {
28 
29 		switch (group->layout) {
30 		case Hy3GroupLayout::SplitH:
31+			child->position.x = tpos.x;
32+			child->size.x = tsize.x - *group_inset;
33+			child->position.y = tpos.y;
34+			child->size.y = tsize.y;
35+			break;
36 		case Hy3GroupLayout::SplitV:
37-			child->position = tpos;
38-			child->size = tsize;
39+			child->position.y = tpos.y;
40+			child->size.y = tsize.y - *group_inset;
41+			child->position.x = tpos.x;
42+			child->size.x = tsize.x;
43 			break;
44 		case Hy3GroupLayout::Tabbed:
45 			child->position.y = tpos.y + tab_height_offset;
46diff --git a/src/main.cpp b/src/main.cpp
47index 8830fef2f2654704d920b16780c253b89784e41e..e92fac1302333c1d8a4c80d563c97a5cf0a97c7c 100644
48--- a/src/main.cpp
49+++ b/src/main.cpp
50@@ -113,6 +113,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
51 	selection_hook::init();
52 
53 	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:no_gaps_when_only", SConfigValue{.intValue = 0});
54+	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:group_inset", SConfigValue{.intValue = 10});
55 	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:height", SConfigValue{.intValue = 15});
56 	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:padding", SConfigValue{.intValue = 5});
57 	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:from_top", SConfigValue{.intValue = 0});