9a5b7c194003c783b2b62287a2853f6c3da9a2f8

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

Message

Add color / padding bar settings

Diff

 1diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
 2index 7f70d69ec395acb3971b92e314fd03fdeaedf817..b93c18172b59de588eaaa12163d1749fdab01326 100644
 3--- a/src/Hy3Layout.cpp
 4+++ b/src/Hy3Layout.cpp
 5@@ -121,8 +121,9 @@ void Hy3Node::recalcSizePosRecursive(bool force) {
 6 	auto tpos = this->position + Vector2D(outer_gaps, outer_gaps);
 7 	auto tsize = this->size - Vector2D(outer_gaps * 2, outer_gaps * 2);
 8 
 9-	static const auto* tab_bar_height = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:bar_height")->intValue;
10-	double tab_height_offset = *gaps_in + *tab_bar_height;
11+	static const auto* tab_bar_height = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:height")->intValue;
12+	static const auto* tab_bar_padding = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:padding")->intValue;
13+	double tab_height_offset = *tab_bar_height + *tab_bar_padding;
14 
15 	if (this->data.type != Hy3NodeData::Group) {
16 		this->data.as_window->setHidden(this->hidden);
17diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
18index 6d24aa9b58b5d072caf8a4f8a0794a9ab387ba1e..7101a32c193581cbe6275fbdb648511fe4a6305d 100644
19--- a/src/TabGroup.cpp
20+++ b/src/TabGroup.cpp
21@@ -4,6 +4,8 @@
22 
23 #include <hyprland/src/Compositor.hpp>
24 #include <cairo/cairo.h>
25+#include <hyprland/src/helpers/Color.hpp>
26+#include <hyprland/src/plugins/PluginAPI.hpp>
27 #include <hyprland/src/render/OpenGL.hpp>
28 #include <pixman.h>
29 
30@@ -47,6 +49,8 @@ void Hy3TabBarEntry::setUrgent(bool urgent) {
31 
32 void Hy3TabBarEntry::prepareTexture(float scale, wlr_box& box) {
33 	static const auto* rounding_setting = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:rounding")->intValue;
34+	static const auto* col_active = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:col.active")->intValue;
35+	static const auto* col_inactive = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:col.inactive")->intValue;
36 
37 	auto width = box.width;
38 	auto height = box.height;
39@@ -75,9 +79,11 @@ void Hy3TabBarEntry::prepareTexture(float scale, wlr_box& box) {
40 
41 		// set brush
42 		if (this->focused) {
43-			cairo_set_source_rgba(cairo, 0.2, 0.7, 1.0, 1.0);
44+			auto c = CColor(*col_active);
45+			cairo_set_source_rgba(cairo, c.r, c.g, c.b, c.a);
46 		} else {
47-			cairo_set_source_rgba(cairo, 0.5, 0.5, 0.5, 1.0);
48+			auto c = CColor(*col_inactive);
49+			cairo_set_source_rgba(cairo, c.r, c.g, c.b, c.a);
50 		}
51 
52 		// outline bar shape
53@@ -266,7 +272,7 @@ void Hy3TabGroup::updateWithGroup(Hy3Node& node) {
54 	Debug::log(LOG, "updated tab bar for %p", &node);
55 	static const auto* gaps_in = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_in")->intValue;
56 	static const auto* gaps_out = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_out")->intValue;
57-	static const auto* bar_height = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:bar_height")->intValue;
58+	static const auto* bar_height = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:height")->intValue;
59 
60 	auto gaps = node.parent == nullptr ? *gaps_out : *gaps_in;
61 	auto tpos = node.position + Vector2D(gaps, gaps);
62diff --git a/src/main.cpp b/src/main.cpp
63index 3ffa2dcf281ee31425d2cdf86a38be1af5f23594..8f5ab4329d2686be6fce250fe611e998bd52ae71 100644
64--- a/src/main.cpp
65+++ b/src/main.cpp
66@@ -106,7 +106,10 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
67 	selection_hook::init();
68 
69 	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:no_gaps_when_only", SConfigValue{.intValue = 0});
70-	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:bar_height", SConfigValue{.intValue = 15});
71+	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:height", SConfigValue{.intValue = 15});
72+	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:padding", SConfigValue{.intValue = 5});
73+	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:col.active", SConfigValue{.intValue = 0xff32b4ff});
74+	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:col.inactive", SConfigValue{.intValue = 0x80808080});
75 	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:from_top", SConfigValue{.intValue = 0});
76 	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:rounding", SConfigValue{.intValue = 3});
77