3f314c62b6980074a1a1bade7da422b6e6e1d4be
- Author
- Janne Heß <janne@hess.ooo>
- 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 4b0844b95112c8d8d38f51a3e2d93595244260d7..dc44eadc53496edc508c07ce36945a4121d663e9 100644
3--- a/CHANGELOG.md
4+++ b/CHANGELOG.md
5@@ -1,5 +1,9 @@
6 # Changelog
7
8+# Upcoming
9+
10+- Added `active_alt_monitor` tab bar color options.
11+
12 # hl0.51.0 and before
13
14 - Only compatibility fixes.
15diff --git a/README.md b/README.md
16index 95da29b06d00281cbec1f4dd7f4415f5b2fc693e..466fe9e004b49298ace4865cf63521d5f1b11d8d 100644
17--- a/README.md
18+++ b/README.md
19@@ -281,6 +281,11 @@ plugin {
20 col.active.border = <color> # default: rgba(33ccffee)
21 col.active.text = <color> # default: rgba(ffffffff)
22
23+ # active tab bar segment colors for bars on an unfocused monitor
24+ col.active_alt_monitor = <color> # default: rgba(60606040)
25+ col.active_alt_monitor.border = <color> # default: rgba(808080ee)
26+ col.active_alt_monitor.text = <color> # default: rgba(ffffffff)
27+
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)
31diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
32index 738716faadbd766803eb16aee790bfd60de2ce06..8eb5804147c6f55912af425876dd522f419e38b2 100644
33--- a/src/TabGroup.cpp
34+++ b/src/TabGroup.cpp
35@@ -66,6 +66,13 @@ Hy3TabBarEntry::Hy3TabBarEntry(Hy3TabBar& tab_bar, Hy3Node& node): tab_bar(tab_b
36 AVARDAMAGE_NONE
37 );
38
39+ g_pAnimationManager->createAnimation(
40+ 0.0F,
41+ this->active_monitor,
42+ g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"),
43+ AVARDAMAGE_NONE
44+ );
45+
46 g_pAnimationManager->createAnimation(
47 -1.0F,
48 this->offset,
49@@ -99,6 +106,7 @@ Hy3TabBarEntry::Hy3TabBarEntry(Hy3TabBar& tab_bar, Hy3Node& node): tab_bar(tab_b
50 this->active->setUpdateCallback(update_callback);
51 this->focused->setUpdateCallback(update_callback);
52 this->urgent->setUpdateCallback(update_callback);
53+ this->active_monitor->setUpdateCallback(update_callback);
54 this->focused->setUpdateCallback(update_callback);
55 this->offset->setUpdateCallback(update_callback);
56 this->width->setUpdateCallback(update_callback);
57@@ -144,6 +152,12 @@ void Hy3TabBarEntry::setWindowTitle(std::string title) {
58 }
59 }
60
61+void Hy3TabBarEntry::setMonitorActive(bool monitorActive) {
62+ if (this->active_monitor->goal() != monitorActive) {
63+ *this->active_monitor = monitorActive;
64+ }
65+}
66+
67 void Hy3TabBarEntry::beginDestroy() {
68 this->destroying = true;
69 *this->vertical_pos = 1.0;
70@@ -176,6 +190,8 @@ void Hy3TabBarEntry::render(float scale, CBox& box, float opacity_mul) {
71 static const auto col_border_urgent = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.urgent.border");
72 static const auto col_locked = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.locked");
73 static const auto col_border_locked = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.locked.border");
74+ static const auto col_active_alt_monitor = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.active_alt_monitor");
75+ static const auto col_border_active_alt_monitor = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.active_alt_monitor.border");
76 static const auto col_inactive = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.inactive");
77 static const auto col_border_inactive = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.inactive.border");
78 // clang-format on
79@@ -183,13 +199,14 @@ void Hy3TabBarEntry::render(float scale, CBox& box, float opacity_mul) {
80 auto radius = std::min((double) *s_radius * scale, std::min(box.width * 0.5, box.height * 0.5));
81
82 auto color =
83- this->mergeColors(*col_active, *col_focused, *col_urgent, *col_locked, *col_inactive);
84+ this->mergeColors(*col_active, *col_focused, *col_urgent, *col_locked, *col_active_alt_monitor, *col_inactive);
85
86 auto border_color = this->mergeColors(
87 *col_border_active,
88 *col_border_focused,
89 *col_border_urgent,
90 *col_border_locked,
91+ *col_border_active_alt_monitor,
92 *col_border_inactive
93 );
94
95@@ -222,6 +239,7 @@ void Hy3TabBarEntry::renderText(float scale, CBox& box, float opacity) {
96 static const auto col_text_focused = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.focused.text");
97 static const auto col_text_urgent = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.urgent.text");
98 static const auto col_text_locked = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.locked.text");
99+ static const auto col_text_active_alt_monitor = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.active_alt_monitor.text");
100 static const auto col_text_inactive = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:col.inactive.text");
101 // clang-format on
102
103@@ -354,6 +372,7 @@ void Hy3TabBarEntry::renderText(float scale, CBox& box, float opacity) {
104 *col_text_focused,
105 *col_text_urgent,
106 *col_text_locked,
107+ *col_text_active_alt_monitor,
108 *col_text_inactive
109 );
110
111@@ -371,6 +390,7 @@ CHyprColor Hy3TabBarEntry::mergeColors(
112 const CHyprColor& focused,
113 const CHyprColor& urgent,
114 const CHyprColor& locked,
115+ const CHyprColor& active_alt_monitor,
116 const CHyprColor& inactive
117 ) {
118 auto active_v = this->active->value();
119@@ -379,11 +399,16 @@ CHyprColor Hy3TabBarEntry::mergeColors(
120 auto locked_v = std::max(0.0f, this->tab_bar.locked->value() - active_v - urgent_v - focused_v);
121 auto inactive_v = 1.0f - (active_v + urgent_v + focused_v + locked_v);
122
123+ auto active_monitor_v = this->active_monitor->value();
124+ auto active_alt_monitor_v = active_v * (1.0 - active_monitor_v);
125+ active_v *= active_monitor_v;
126+
127 return merge_colors(
128 std::make_pair(active_v, active),
129 std::make_pair(urgent_v, urgent),
130 std::make_pair(focused_v, focused),
131 std::make_pair(locked_v, locked),
132+ std::make_pair(active_alt_monitor_v, active_alt_monitor),
133 std::make_pair(inactive_v, inactive)
134 );
135diff --git a/src/TabGroup.hpp b/src/TabGroup.hpp
136index dafa06531bd4c92a6b89f1187b2c14b0d1345e24..1888f9051850107a15751f727b42ba4fb3c4a2af 100644
137--- a/src/TabGroup.hpp
138+++ b/src/TabGroup.hpp
139@@ -21,12 +21,13 @@ struct Hy3TabBarEntry {
140 PHLANIMVAR<float> active;
141 PHLANIMVAR<float> focused;
142 PHLANIMVAR<float> urgent;
143+ PHLANIMVAR<float> active_monitor;
144 PHLANIMVAR<float> offset; // 0.0-1.0 of total bar
145 PHLANIMVAR<float> width; // 0.0-1.0 of total bar
146 PHLANIMVAR<float> vertical_pos; // 0.0-1.0, user specified direction
147 PHLANIMVAR<float> fade_opacity; // 0.0-1.0
148 Hy3TabBar& tab_bar;
149- Hy3Node& node; // only used for comparioson. do not deref.
150+ Hy3Node& node; // only used for comparison. do not deref.
151
152 struct {
153 float scale = 0.0;
154@@ -54,6 +55,7 @@ struct Hy3TabBarEntry {
155 void setFocused(bool);
156 void setUrgent(bool);
157 void setWindowTitle(std::string);
158+ void setMonitorActive(bool);
159 void beginDestroy();
160 void unDestroy();
161 bool shouldRemove();
162@@ -66,6 +68,7 @@ private:
163 const CHyprColor& focused,
164 const CHyprColor& urgent,
165 const CHyprColor& locked,
166+ const CHyprColor& inactiveMonitor,
167 const CHyprColor& inactive
168 );
169 };
170@@ -77,6 +80,8 @@ public:
171 bool damaged = true;
172 PHLANIMVAR<float> fade_opacity;
173 PHLANIMVAR<float> locked;
174+ // The monitor this bar resides on
175+ MONITORID monitor_id = MONITOR_INVALID;
176
177 Hy3TabBar();
178 void beginDestroy();
179diff --git a/src/main.cpp b/src/main.cpp
180index f74cca89cc5a0200ca64e25e5670f16cf3fc08ab..aa8d427b5dd509e49315c7b9785647f06d96f431 100644
181--- a/src/main.cpp
182+++ b/src/main.cpp
183@@ -57,6 +57,9 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
184 CONF("tabs:col.active", INT, 0x4033ccff);
185 CONF("tabs:col.active.border", INT, 0xee33ccff);
186 CONF("tabs:col.active.text", INT, 0xffffffff);
187+ CONF("tabs:col.active_alt_monitor", INT, 0x40606060);
188+ CONF("tabs:col.active_alt_monitor.border", INT, 0xee808080);
189+ CONF("tabs:col.active_alt_monitor.text", INT, 0xffffffff);
190 CONF("tabs:col.focused", INT, 0x40606060);
191 CONF("tabs:col.focused.border", INT, 0xee808080);
192 CONF("tabs:col.focused.text", INT, 0xffffffff);