d7e0c58a1116df3d79f24a225f17b988112ca1ad

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

Message

fix lua config fields

Diff

  1diff --git a/CHANGELOG.md b/CHANGELOG.md
  2index 89ed4fb173221c3ea8155a7e4183f5d947e91a81..f977450dc9152cc07af44cb050a8db1aea57d243 100644
  3--- a/CHANGELOG.md
  4+++ b/CHANGELOG.md
  5@@ -4,6 +4,7 @@
  6 
  7 - Fixed a crash when using locked opaque tabs.
  8 - Fixed a crash when removing a monitor.
  9+- `tabs.col` options have been renamed to support lua. See readme for details.
 10 
 11 # hl0.54.2.1 and before
 12 
 13diff --git a/README.md b/README.md
 14index 320d21567c3dc7da31ef423f9b79e63fd62a910a..cdde20300b9452470598801b1821cac98bd2ab64 100644
 15--- a/README.md
 16+++ b/README.md
 17@@ -270,35 +270,37 @@ plugin {
 18       # left padding of the window title
 19       text_padding = <int> # default: 3
 20 
 21-      # active tab bar segment colors
 22-      col.active = <color> # default: rgba(33ccff40)
 23-      col.active.border = <color> # default: rgba(33ccffee)
 24-      col.active.text = <color> # default: rgba(ffffffff)
 25-
 26-      # active tab bar segment colors for bars on an unfocused monitor
 27-      col.active_alt_monitor = <color> # default: rgba(60606040)
 28-      col.active_alt_monitor.border = <color> # default: rgba(808080ee)
 29-      col.active_alt_monitor.text = <color> # default: rgba(ffffffff)
 30-
 31-      # focused tab bar segment colors (focused node in unfocused container)
 32-      col.focused = <color> # default: rgba(60606040)
 33-      col.focused.border = <color> # default: rgba(808080ee)
 34-      col.focused.text = <color> # default: rgba(ffffffff)
 35-
 36-      # inactive tab bar segment colors
 37-      col.inactive = <color> # default: rgba(30303020)
 38-      col.inactive.border = <color> # default: rgba(606060aa)
 39-      col.inactive.text = <color> # default: rgba(ffffffff)
 40-
 41-      # urgent tab bar segment colors
 42-      col.urgent = <color> # default: rgba(ff223340)
 43-      col.urgent.border = <color> # default: rgba(ff2233ee)
 44-      col.urgent.text = <color> # default: rgba(ffffffff)
 45-
 46-      # urgent tab bar segment colors
 47-      col.locked = <color> # default: rgba(90903340)
 48-      col.locked.border = <color> # default: rgba(909033ee)
 49-      col.locked.text = <color> # default: rgba(ffffffff)
 50+      colors {
 51+        # active tab bar segment colors
 52+        active = <color> # default: rgba(33ccff40)
 53+        active_border = <color> # default: rgba(33ccffee)
 54+        active_text = <color> # default: rgba(ffffffff)
 55+
 56+        # active tab bar segment colors for bars on an unfocused monitor
 57+        active_alt_monitor = <color> # default: rgba(60606040)
 58+        active_alt_monitor_border = <color> # default: rgba(808080ee)
 59+        active_alt_monitor_text = <color> # default: rgba(ffffffff)
 60+
 61+        # focused tab bar segment colors (focused node in unfocused container)
 62+        focused = <color> # default: rgba(60606040)
 63+        focused_border = <color> # default: rgba(808080ee)
 64+        focused_text = <color> # default: rgba(ffffffff)
 65+
 66+        # inactive tab bar segment colors
 67+        inactive = <color> # default: rgba(30303020)
 68+        inactive_border = <color> # default: rgba(606060aa)
 69+        inactive_text = <color> # default: rgba(ffffffff)
 70+
 71+        # urgent tab bar segment colors
 72+        urgent = <color> # default: rgba(ff223340)
 73+        urgent_border = <color> # default: rgba(ff2233ee)
 74+        urgent_text = <color> # default: rgba(ffffffff)
 75+
 76+        # locked tab bar segment colors
 77+        locked = <color> # default: rgba(90903340)
 78+        locked_border = <color> # default: rgba(909033ee)
 79+        locked_text = <color> # default: rgba(ffffffff)
 80+      }
 81 
 82       # if tab backgrounds should be blurred
 83       # Blur is only visible when the above colors are not opaque.
 84diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
 85index 3c39cf20b3dd3390bbfc43c258a967f9fea55f55..0f9ffaf16c9e7fc97e1fa397c8c03156d9ecd31c 100644
 86--- a/src/TabGroup.cpp
 87+++ b/src/TabGroup.cpp
 88@@ -188,18 +188,18 @@ void Hy3TabBarEntry::render(float scale, CBox& box, float opacity_mul) {
 89 	static const auto border_width = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:border_width");
 90 	static const auto s_opacity = CConfigValue<Config::FLOAT>("plugin:hy3:tabs:opacity");
 91 	static const auto blur = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:blur");
 92-	static const auto col_active = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.active");
 93-	static const auto col_border_active = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.active.border");
 94-	static const auto col_focused = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.focused");
 95-	static const auto col_border_focused = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.focused.border");
 96-	static const auto col_urgent = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.urgent");
 97-	static const auto col_border_urgent = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.urgent.border");
 98-	static const auto col_locked = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.locked");
 99-	static const auto col_border_locked = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.locked.border");
100-	static const auto col_active_alt_monitor = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.active_alt_monitor");
101-	static const auto col_border_active_alt_monitor = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.active_alt_monitor.border");
102-	static const auto col_inactive = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.inactive");
103-	static const auto col_border_inactive = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.inactive.border");
104+	static const auto col_active = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:active");
105+	static const auto col_border_active = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:active_border");
106+	static const auto col_focused = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:focused");
107+	static const auto col_border_focused = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:focused_border");
108+	static const auto col_urgent = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:urgent");
109+	static const auto col_border_urgent = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:urgent_border");
110+	static const auto col_locked = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:locked");
111+	static const auto col_border_locked = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:locked_border");
112+	static const auto col_active_alt_monitor = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:active_alt_monitor");
113+	static const auto col_border_active_alt_monitor = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:active_alt_monitor_border");
114+	static const auto col_inactive = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:inactive");
115+	static const auto col_border_inactive = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:inactive_border");
116 	// clang-format on
117 
118 	auto radius = std::min((double) *s_radius * scale, std::min(box.width * 0.5, box.height * 0.5));
119@@ -241,12 +241,12 @@ void Hy3TabBarEntry::renderText(float scale, CBox& box, float opacity) {
120 	static const auto text_font = CConfigValue<Config::STRING>("plugin:hy3:tabs:text_font");
121 	static const auto text_height = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:text_height");
122 	static const auto text_padding = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:text_padding");
123-	static const auto col_text_active = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.active.text");
124-	static const auto col_text_focused = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.focused.text");
125-	static const auto col_text_urgent = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.urgent.text");
126-	static const auto col_text_locked = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.locked.text");
127-	static const auto col_text_active_alt_monitor = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.active_alt_monitor.text");
128-	static const auto col_text_inactive = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.inactive.text");
129+	static const auto col_text_active = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:active_text");
130+	static const auto col_text_focused = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:focused_text");
131+	static const auto col_text_urgent = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:urgent_text");
132+	static const auto col_text_locked = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:locked_text");
133+	static const auto col_text_active_alt_monitor = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:active_alt_monitor_text");
134+	static const auto col_text_inactive = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:inactive_text");
135 	// clang-format on
136 
137 	if (!*render_text) {
138@@ -867,16 +867,16 @@ bool Hy3TabPassElement::needsPrecomputeBlur() {
139 	// clang-format off
140 	static const auto s_opacity = CConfigValue<Config::FLOAT>("plugin:hy3:tabs:opacity");
141 	static const auto blur = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:blur");
142-	static const auto col_active = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.active");
143-	static const auto col_border_active = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.active.border");
144-	static const auto col_focused = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.focused");
145-	static const auto col_border_focused = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.focused.border");
146-	static const auto col_urgent = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.urgent");
147-	static const auto col_border_urgent = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.urgent.border");
148-	static const auto col_locked = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.locked");
149-	static const auto col_border_locked = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.locked.border");
150-	static const auto col_inactive = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.inactive");
151-	static const auto col_border_inactive = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:col.inactive.border");
152+	static const auto col_active = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:active");
153+	static const auto col_border_active = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:active_border");
154+	static const auto col_focused = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:focused");
155+	static const auto col_border_focused = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:focused_border");
156+	static const auto col_urgent = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:urgent");
157+	static const auto col_border_urgent = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:urgent_border");
158+	static const auto col_locked = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:locked");
159+	static const auto col_border_locked = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:locked_border");
160+	static const auto col_inactive = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:inactive");
161+	static const auto col_border_inactive = CConfigValue<Config::INTEGER>("plugin:hy3:tabs:colors:inactive_border");
162 	// clang-format on
163 
164 	if (!*blur) return false;
165diff --git a/src/main.cpp b/src/main.cpp
166index d4ef18216b177133de3b384d37ebc2d952cadf6a..e94689eef0bbfbffb571b07479e492d38f5f2666 100644
167--- a/src/main.cpp
168+++ b/src/main.cpp
169@@ -37,43 +37,43 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
170 	CONF("no_gaps_when_only", Int, 0);
171 	CONF("node_collapse_policy", Int, 2);
172 	CONF("group_inset", Int, 10);
173-	CONF("tab_first_window", Int, 0);
174+	CONF("tab_first_window", Bool, false);
175 
176 	// tabs
177 	CONF("tabs:height", Int, 22);
178 	CONF("tabs:padding", Int, 5);
179-	CONF("tabs:from_top", Int, 0);
180+	CONF("tabs:from_top", Bool, false);
181 	CONF("tabs:radius", Int, 6);
182 	CONF("tabs:border_width", Int, 2);
183-	CONF("tabs:render_text", Int, 1);
184-	CONF("tabs:text_center", Int, 1);
185+	CONF("tabs:render_text", Bool, true);
186+	CONF("tabs:text_center", Bool, true);
187 	CONF("tabs:text_font", String, "Sans");
188 	CONF("tabs:text_height", Int, 8);
189 	CONF("tabs:text_padding", Int, 3);
190 	CONF("tabs:opacity", Float, 1.0);
191-	CONF("tabs:blur", Int, 1);
192-	CONF("tabs:col.active", Int, 0x4033ccff);
193-	CONF("tabs:col.active.border", Int, 0xee33ccff);
194-	CONF("tabs:col.active.text", Int, 0xffffffff);
195-	CONF("tabs:col.active_alt_monitor", Int, 0x40606060);
196-	CONF("tabs:col.active_alt_monitor.border", Int, 0xee808080);
197-	CONF("tabs:col.active_alt_monitor.text", Int, 0xffffffff);
198-	CONF("tabs:col.focused", Int, 0x40606060);
199-	CONF("tabs:col.focused.border", Int, 0xee808080);
200-	CONF("tabs:col.focused.text", Int, 0xffffffff);
201-	CONF("tabs:col.inactive", Int, 0x20303030);
202-	CONF("tabs:col.inactive.border", Int, 0xaa606060);
203-	CONF("tabs:col.inactive.text", Int, 0xffffffff);
204-	CONF("tabs:col.urgent", Int, 0x40ff2233);
205-	CONF("tabs:col.urgent.border", Int, 0xeeff2233);
206-	CONF("tabs:col.urgent.text", Int, 0xffffffff);
207-	CONF("tabs:col.locked", Int, 0x40909033);
208-	CONF("tabs:col.locked.border", Int, 0xee909033);
209-	CONF("tabs:col.locked.text", Int, 0xffffffff);
210+	CONF("tabs:blur", Bool, true);
211+	CONF("tabs:colors:active", Color, 0x4033ccff);
212+	CONF("tabs:colors:active_border", Color, 0xee33ccff);
213+	CONF("tabs:colors:active_text", Color, 0xffffffff);
214+	CONF("tabs:colors:active_alt_monitor", Color, 0x40606060);
215+	CONF("tabs:colors:active_alt_monitor_border", Color, 0xee808080);
216+	CONF("tabs:colors:active_alt_monitor_text", Color, 0xffffffff);
217+	CONF("tabs:colors:focused", Color, 0x40606060);
218+	CONF("tabs:colors:focused_border", Color, 0xee808080);
219+	CONF("tabs:colors:focused_text", Color, 0xffffffff);
220+	CONF("tabs:colors:inactive", Color, 0x20303030);
221+	CONF("tabs:colors:inactive_border", Color, 0xaa606060);
222+	CONF("tabs:colors:inactive_text", Color, 0xffffffff);
223+	CONF("tabs:colors:urgent", Color, 0x40ff2233);
224+	CONF("tabs:colors:urgent_border", Color, 0xeeff2233);
225+	CONF("tabs:colors:urgent_text", Color, 0xffffffff);
226+	CONF("tabs:colors:locked", Color, 0x40909033);
227+	CONF("tabs:colors:locked_border", Color, 0xee909033);
228+	CONF("tabs:colors:locked_text", Color, 0xffffffff);
229 
230 	// autotiling
231-	CONF("autotile:enable", Int, 0);
232-	CONF("autotile:ephemeral_groups", Int, 1);
233+	CONF("autotile:enable", Bool, false);
234+	CONF("autotile:ephemeral_groups", Bool, true);
235 	CONF("autotile:trigger_height", Int, 0);
236 	CONF("autotile:trigger_width", Int, 0);
237 	CONF("autotile:workspaces", String, "all");