977a4d355d6553a3a1b27d725c52e1d133aad720
- Author
- outfoxxed <outfoxxed@outfoxxed.me>
- Committer
- outfoxxed <outfoxxed@outfoxxed.me>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/CHANGELOG.md b/CHANGELOG.md
2index 2ad8c11cfb489024677413910b51af15913980ae..789eb08a5db311788c1764e05e7cbb6ef07c424c 100644
3--- a/CHANGELOG.md
4+++ b/CHANGELOG.md
5@@ -1,5 +1,10 @@
6 # Changelog
7
8+# Upcoming
9+- Added focused tab color, to mark selected tabs inside an unfocused container.
10+- Fixed tab rendering on rotated displays.
11+- Fixed tabs being clickable throguh fullscreen windows.
12+
13 # hl0.47.0 and before
14
15 - Added configurable borders and blurred backgrounds to tabs.
16diff --git a/README.md b/README.md
17index 528bd563243b1346316406a2d51ff6991315d5d2..a31aeace8c514eb951efc5e25a126fd47863dd3c 100644
18--- a/README.md
19+++ b/README.md
20@@ -281,16 +281,21 @@ plugin {
21 col.active.border = <color> # default: rgba(70b0c0ff)
22 col.active.text = <color> # default: rgba(ffffffff)
23
24- # urgent tab bar segment colors
25- col.urgent = <color> # default: rgba(ff4f4fff)
26- col.urgent.border = <color> # default: rgba(ff8080ff)
27- col.urgent.text = <color> # default: rgba(ffffffff)
28+ # focused tab bar segment colors (focused node in unfocused container)
29+ col.focused = <color> # default: rgba(60606040)
30+ col.focused.border = <color> # default: rgba(808080ee)
31+ col.focused.text = <color> # default: rgba(ffffffff)
32
33 # inactive tab bar segment colors
34 col.inactive = <color> # default: rgba(30303050)
35 col.inactive.border = <color> # default: rgba(50505090)
36 col.inactive.text = <color> # default: rgba(ffffffff)
37
38+ # urgent tab bar segment colors
39+ col.urgent = <color> # default: rgba(ff4f4fff)
40+ col.urgent.border = <color> # default: rgba(ff8080ff)
41+ col.urgent.text = <color> # default: rgba(ffffffff)
42+
43 # if tab backgrounds should be blurred
44 # Blur is only visible when the above colors are not opaque.
45 blur = <bool> # default: true
46diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
47index 4da574bdc5bbfea1021b36d4c773f43e0d5d6ceb..8fac8da8d8f6cb8d4463e1dc17f74f98d3a2651a 100644
48--- a/src/TabGroup.cpp
49+++ b/src/TabGroup.cpp
50@@ -45,6 +45,13 @@ CHyprColor merge_colors(Args... colors) {
51 }
52
53 Hy3TabBarEntry::Hy3TabBarEntry(Hy3TabBar& tab_bar, Hy3Node& node): tab_bar(tab_bar), node(node) {
54+ g_pAnimationManager->createAnimation(
55+ 0.0F,
56+ this->active,
57+ g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"),
58+ AVARDAMAGE_NONE
59+ );
60+
61 g_pAnimationManager->createAnimation(
62 0.0F,
63 this->focused,
64@@ -89,6 +96,7 @@ Hy3TabBarEntry::Hy3TabBarEntry(Hy3TabBar& tab_bar, Hy3Node& node): tab_bar(tab_b
65
66 auto update_callback = [this](auto) { this->tab_bar.dirty = true; };
67
68+ this->active->setUpdateCallback(update_callback);
69 this->focused->setUpdateCallback(update_callback);
70 this->urgent->setUpdateCallback(update_callback);
71 this->offset->setUpdateCallback(update_callback);
72@@ -109,6 +117,12 @@ bool Hy3TabBarEntry::operator==(const Hy3TabBarEntry& entry) const {
73 return this->node == entry.node;
74 }
75
76+void Hy3TabBarEntry::setActive(bool active) {
77+ if (this->active->goal() != active) {
78+ *this->active = active;
79+ }
80+}
81+
82 void Hy3TabBarEntry::setFocused(bool focused) {
83 if (this->focused->goal() != focused) {
84 *this->focused = focused;
85@@ -155,6 +169,8 @@ void Hy3TabBarEntry::render(float scale, CBox& box, float opacity_mul) {
86 static const auto blur = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:blur");
87 static const auto col_active = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.active");
88 static const auto col_border_active = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.active.border");
89+ static const auto col_focused = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.focused");
90+ static const auto col_border_focused = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.focused.border");
91 static const auto col_urgent = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.urgent");
92 static const auto col_border_urgent = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.urgent.border");
93 static const auto col_inactive = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.inactive");
94@@ -163,10 +179,14 @@ void Hy3TabBarEntry::render(float scale, CBox& box, float opacity_mul) {
95
96 auto radius = std::min((double) *s_radius * scale, std::min(box.width * 0.5, box.height * 0.5));
97
98- auto color = this->mergeColors(*col_active, *col_urgent, *col_inactive);
99+ auto color = this->mergeColors(*col_active, *col_focused, *col_urgent, *col_inactive);
100
101- auto border_color =
102- this->mergeColors(*col_border_active, *col_border_urgent, *col_border_inactive);
103+ auto border_color = this->mergeColors(
104+ *col_border_active,
105+ *col_border_focused,
106+ *col_border_urgent,
107+ *col_border_inactive
108+ );
109
110 box.round();
111
112@@ -194,6 +214,7 @@ void Hy3TabBarEntry::renderText(float scale, CBox& box, float opacity) {
113 static const auto text_height = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:text_height");
114 static const auto text_padding = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:text_padding");
115 static const auto col_text_active = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.active.text");
116+ static const auto col_text_focused = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.active.text");
117 static const auto col_text_urgent = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.urgent.text");
118 static const auto col_text_inactive = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.inactive.text");
119 // clang-format on
120@@ -322,7 +343,7 @@ void Hy3TabBarEntry::renderText(float scale, CBox& box, float opacity) {
121
122 texture_box.round();
123
124- auto c = mergeColors(*col_text_active, *col_text_urgent, *col_text_inactive);
125+ auto c = mergeColors(*col_text_active, *col_text_focused, *col_text_urgent, *col_text_inactive);
126
127 glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_SRC_ALPHA);
128 glBlendColor(c.r, c.g, c.b, c.a);
129@@ -334,15 +355,19 @@ void Hy3TabBarEntry::renderText(float scale, CBox& box, float opacity) {
130 }
131
132 CHyprColor Hy3TabBarEntry::mergeColors(
133+ const CHyprColor& active,
134 const CHyprColor& focused,
135 const CHyprColor& urgent,
136 const CHyprColor& inactive
137 ) {
138- auto focused_v = this->focused->value();
139+ auto focused_av = this->focused->value();
140+ auto active_v = this->active->value();
141+ auto focused_v = focused_av - active_v;
142 auto urgent_v = this->urgent->value();
143- auto inactive_v = 1.0f - (focused_v + urgent_v);
144+ auto inactive_v = 1.0f - (focused_av + urgent_v);
145
146 return merge_colors(
147+ std::make_pair(active_v, active),
148 std::make_pair(focused_v, focused),
149 std::make_pair(urgent_v, urgent),
150diff --git a/src/TabGroup.hpp b/src/TabGroup.hpp
151index 06ea38dcf7440a6dc80dba99bfd49f1b78bc9578..dbc41299e4b0a5fe99818763b3ddede25bfe6d0d 100644
152--- a/src/TabGroup.hpp
153+++ b/src/TabGroup.hpp
154@@ -6,7 +6,6 @@ class Hy3TabGroup;
155 class Hy3TabBar;
156
157 #include <list>
158-#include <memory>
159 #include <vector>
160
161 #include <hyprland/src/plugins/PluginAPI.hpp>
162@@ -19,6 +18,7 @@ struct Hy3TabBarEntry {
163 std::string window_title;
164 bool destroying = false;
165 SP<CTexture> texture;
166+ PHLANIMVAR<float> active;
167 PHLANIMVAR<float> focused;
168 PHLANIMVAR<float> urgent;
169 PHLANIMVAR<float> offset; // 0.0-1.0 of total bar
170@@ -50,6 +50,7 @@ struct Hy3TabBarEntry {
171 bool operator==(const Hy3Node&) const;
172 bool operator==(const Hy3TabBarEntry&) const;
173
174+ void setActive(bool);
175 void setFocused(bool);
176 void setUrgent(bool);
177 void setWindowTitle(std::string);
178@@ -60,8 +61,12 @@ struct Hy3TabBarEntry {
179
180 private:
181 void renderText(float scale, CBox& box, float opacity);
182- CHyprColor
183- mergeColors(const CHyprColor& focused, const CHyprColor& urgent, const CHyprColor& inactive);
184+ CHyprColor mergeColors(
185+ const CHyprColor& active,
186+ const CHyprColor& focused,
187+ const CHyprColor& urgent,
188+ const CHyprColor& inactive
189+ );
190 };
191
192 class Hy3TabBar {
193diff --git a/src/main.cpp b/src/main.cpp
194index 35d0437d6d4da2d4dc22432f4027ec5f86e434cd..4fa2de344482a686156ca9c2ca1e07f682cc2260 100644
195--- a/src/main.cpp
196+++ b/src/main.cpp
197@@ -57,12 +57,15 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
198 CONF("tabs:col.active", INT, 0x4033ccff);
199 CONF("tabs:col.active.border", INT, 0xee33ccff);
200 CONF("tabs:col.active.text", INT, 0xffffffff);
201- CONF("tabs:col.urgent", INT, 0x40ff2233);
202- CONF("tabs:col.urgent.border", INT, 0xeeff2233);
203- CONF("tabs:col.urgent.text", INT, 0xffffffff);
204+ CONF("tabs:col.focused", INT, 0x40606060);
205+ CONF("tabs:col.focused.border", INT, 0xee808080);
206+ CONF("tabs:col.focused.text", INT, 0xffffffff);
207 CONF("tabs:col.inactive", INT, 0x20303030);
208 CONF("tabs:col.inactive.border", INT, 0xaa606060);
209 CONF("tabs:col.inactive.text", INT, 0xffffffff);
210+ CONF("tabs:col.urgent", INT, 0x40ff2233);
211+ CONF("tabs:col.urgent.border", INT, 0xeeff2233);
212+ CONF("tabs:col.urgent.text", INT, 0xffffffff);
213
214 // autotiling
215 CONF("autotile:enable", INT, 0);