db01e6208dc40a80f2e865d9689ea8275659ae27

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

Message

fix tabs overlaying no_gaps_when_only windows

Fixes #145

Diff

 1diff --git a/CHANGELOG.md b/CHANGELOG.md
 2index 283a4b3d3867b1e40cfc0faf1aa0992030662713..d93af33ff12f492b866e5c09f13fd3ec95b1e37a 100644
 3--- a/CHANGELOG.md
 4+++ b/CHANGELOG.md
 5@@ -6,6 +6,7 @@
 6 - Added support for special workspaces
 7 - Added monitor switching support to hy3:movefocus
 8 - Added support for gapsin and gapsout workspace rules
 9+- Fixed tab bars with no_gaps_when_only
10 
11 # hl0.44.0 and before
12 
13diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
14index 9547d5a479f1cdcc4b6d1bac8aadc1685ce70f71..0bd3c0e7da9a76e33f2481b11c404287029d2b97 100644
15--- a/src/TabGroup.cpp
16+++ b/src/TabGroup.cpp
17@@ -448,11 +448,20 @@ void damageBox(const Vector2D* position, const Vector2D* size) {
18 void Hy3TabGroup::tick() {
19 	static const auto enter_from_top = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:from_top");
20 	static const auto padding = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:padding");
21+	static const auto no_gaps_when_only = ConfigValue<Hyprlang::INT>("plugin:hy3:no_gaps_when_only");
22 
23 	this->bar.tick();
24 
25 	if (valid(this->workspace)) {
26-		if (this->workspace->m_bHasFullscreenWindow) {
27+		auto has_fullscreen = this->workspace->m_bHasFullscreenWindow;
28+
29+		if (!has_fullscreen && *no_gaps_when_only) {
30+			auto root_node = g_Hy3Layout->getWorkspaceRootGroup(this->workspace);
31+			has_fullscreen = root_node != nullptr && root_node->data.as_group().children.size() == 1
32+										&& root_node->data.as_group().children.front()->data.is_window();
33+		}
34+
35+		if (has_fullscreen) {
36 			if (this->bar.fade_opacity.goal() != 0.0) this->bar.fade_opacity = 0.0;
37 		} else {
38 			if (this->bar.fade_opacity.goal() != 1.0) this->bar.fade_opacity = 1.0;