Diff
1diff --git a/CHANGELOG.md b/CHANGELOG.md
2index 935fcc58bf94063c50d9690d3018ed5afc9cde62..283a4b3d3867b1e40cfc0faf1aa0992030662713 100644
3--- a/CHANGELOG.md
4+++ b/CHANGELOG.md
5@@ -5,6 +5,7 @@
6 - Added hyprsplit compatibility for hy3:movetoworkspace
7 - Added support for special workspaces
8 - Added monitor switching support to hy3:movefocus
9+- Added support for gapsin and gapsout workspace rules
10
11 # hl0.44.0 and before
12
13diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
14index 8fadaac89474525da866b6237329fab8da4fc4e1..43aeffbe6a29190d119e7901fbab568353b77741 100644
15--- a/src/Hy3Layout.cpp
16+++ b/src/Hy3Layout.cpp
17@@ -1179,18 +1179,22 @@ bottom:
18
19 Hy3Node* findTabBarAt(Hy3Node& node, Vector2D pos, Hy3Node** focused_node) {
20 // clang-format off
21- static const auto gaps_in = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_in");
22- static const auto gaps_out = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_out");
23+ static const auto p_gaps_in = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_in");
24+ static const auto p_gaps_out = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_out");
25 static const auto tab_bar_height = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:height");
26 static const auto tab_bar_padding = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:padding");
27 // clang-format on
28
29+ auto workspace_rule = g_pConfigManager->getWorkspaceRuleFor(node.workspace);
30+ auto gaps_in = workspace_rule.gapsIn.value_or(*p_gaps_in);
31+ auto gaps_out = workspace_rule.gapsOut.value_or(*p_gaps_out);
32+
33 auto inset = *tab_bar_height + *tab_bar_padding;
34
35 if (node.parent == nullptr) {
36- inset += gaps_out->left;
37+ inset += gaps_out.left;
38 } else {
39- inset += gaps_in->left;
40+ inset += gaps_in.left;
41 }
42
43 if (node.data.is_group()) {
44diff --git a/src/Hy3Node.cpp b/src/Hy3Node.cpp
45index 3eaf4961df36106eaa63dea5c2fb3723608d53dd..b9aa7bd5d3b3711307aef80f33e2a1a05bb7a965 100644
46--- a/src/Hy3Node.cpp
47+++ b/src/Hy3Node.cpp
48@@ -299,20 +299,24 @@ Hy3Node& Hy3Node::getExpandActor() {
49
50 void Hy3Node::recalcSizePosRecursive(bool no_animation) {
51 // clang-format off
52- static const auto gaps_in = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_in");
53- static const auto gaps_out = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_out");
54+ static const auto p_gaps_in = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_in");
55+ static const auto p_gaps_out = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_out");
56 static const auto group_inset = ConfigValue<Hyprlang::INT>("plugin:hy3:group_inset");
57 static const auto tab_bar_height = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:height");
58 static const auto tab_bar_padding = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:padding");
59
60+ auto workspace_rule = g_pConfigManager->getWorkspaceRuleFor(this->workspace);
61+ auto gaps_in = workspace_rule.gapsIn.value_or(*p_gaps_in);
62+ auto gaps_out = workspace_rule.gapsOut.value_or(*p_gaps_out);
63+
64 auto gap_topleft_offset = Vector2D(
65- (int) -(gaps_in->left - gaps_out->left),
66- (int) -(gaps_in->top - gaps_out->top)
67+ (int) -(gaps_in.left - gaps_out.left),
68+ (int) -(gaps_in.top - gaps_out.top)
69 );
70
71 auto gap_bottomright_offset = Vector2D(
72- (int) -(gaps_in->right - gaps_out->right),
73- (int) -(gaps_in->bottom - gaps_out->bottom)
74+ (int) -(gaps_in.right - gaps_out.right),
75+ (int) -(gaps_in.bottom - gaps_out.bottom)
76 );
77 // clang-format on
78
79@@ -631,11 +635,14 @@ void Hy3Node::setHidden(bool hidden) {
80 }
81
82 CBox Hy3Node::getStandardWindowArea(SBoxExtents extents) {
83- static const auto gaps_in = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_in");
84+ static const auto p_gaps_in = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_in");
85+
86+ auto workspace_rule = g_pConfigManager->getWorkspaceRuleFor(this->workspace);
87+ auto gaps_in = workspace_rule.gapsIn.value_or(*p_gaps_in);
88
89 SBoxExtents inner_gap_extents;
90- inner_gap_extents.topLeft = {(int) -gaps_in->left, (int) -gaps_in->top};
91- inner_gap_extents.bottomRight = {(int) -gaps_in->right, (int) -gaps_in->bottom};
92+ inner_gap_extents.topLeft = {(int) -gaps_in.left, (int) -gaps_in.top};
93+ inner_gap_extents.bottomRight = {(int) -gaps_in.right, (int) -gaps_in.bottom};
94
95 SBoxExtents combined_outer_extents;
96 combined_outer_extents.topLeft = -this->gap_topleft_offset;