f79697754361c9bbf7a30cadd06b81b560c0228f
- Author
- outfoxxed <outfoxxed@outfoxxed.me>
- Committer
- outfoxxed <outfoxxed@outfoxxed.me>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/.clang-format b/.clang-format
2index 89917c253ccb755eef0c9e651fe28724f1305887..faedbee8795ced78945d1fc463cd567ac191cd6e 100644
3--- a/.clang-format
4+++ b/.clang-format
5@@ -1,4 +1,3 @@
6----
7 AlignArrayOfStructures: None
8 AlignAfterOpenBracket: BlockIndent
9 AllowShortBlocksOnASingleLine: Always
10@@ -30,9 +29,9 @@ SpaceBeforeCpp11BracedList: true
11 SpaceBeforeCtorInitializerColon: false
12 SpaceBeforeInheritanceColon: false
13 SpaceBeforeParens: ControlStatementsExceptControlMacros
14-SortIncludes: CaseInsensitive
15+SortIncludes: CaseSensitive
16 PointerAlignment: Left
17-PackConstructorInitializers: CurrentLine
18+PackConstructorInitializers: NextLine
19 LineEnding: LF
20 InsertBraces: false
21 BreakConstructorInitializers: AfterColon
22@@ -59,7 +58,7 @@ BraceWrapping:
23 SplitEmptyRecord: false
24 SplitEmptyNamespace: false
25 AfterControlStatement: MultiLine
26-BreakBeforeBinaryOperators: All
27+BreakBeforeBinaryOperators: NonAssignment
28 BreakBeforeTernaryOperators: true
29 AlignOperands: AlignAfterOperator
30 InsertTrailingCommas: Wrapped
31@@ -70,3 +69,14 @@ IndentWidth: 2
32 TabWidth: 2
33 AllowAllConstructorInitializersOnNextLine: false
34 ConstructorInitializerAllOnOneLineOrOnePerLine: true
35+NamespaceIndentation: None
36+IncludeBlocks: Regroup
37+IncludeCategories:
38diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
39index d34a0b29f44b4350e47d2eef9f4ab743f2fff22e..617e22d8b69198b69b601d8a7b5636526e630352 100644
40--- a/src/Hy3Layout.cpp
41+++ b/src/Hy3Layout.cpp
42@@ -1,20 +1,21 @@
43-#include <hyprland/src/Compositor.hpp>
44-#include <hyprland/src/plugins/PluginAPI.hpp>
45 #include <regex>
46 #include <set>
47
48-#include "globals.hpp"
49+#include <hyprland/src/Compositor.hpp>
50+#include <hyprland/src/plugins/PluginAPI.hpp>
51+
52 #include "Hy3Layout.hpp"
53 #include "SelectionHook.hpp"
54+#include "globals.hpp"
55
56-std::unique_ptr<HOOK_CALLBACK_FN> renderHookPtr
57- = std::make_unique<HOOK_CALLBACK_FN>(Hy3Layout::renderHook);
58-std::unique_ptr<HOOK_CALLBACK_FN> windowTitleHookPtr
59- = std::make_unique<HOOK_CALLBACK_FN>(Hy3Layout::windowGroupUpdateRecursiveHook);
60-std::unique_ptr<HOOK_CALLBACK_FN> urgentHookPtr
61- = std::make_unique<HOOK_CALLBACK_FN>(Hy3Layout::windowGroupUrgentHook);
62-std::unique_ptr<HOOK_CALLBACK_FN> tickHookPtr
63- = std::make_unique<HOOK_CALLBACK_FN>(Hy3Layout::tickHook);
64+std::unique_ptr<HOOK_CALLBACK_FN> renderHookPtr =
65+ std::make_unique<HOOK_CALLBACK_FN>(Hy3Layout::renderHook);
66+std::unique_ptr<HOOK_CALLBACK_FN> windowTitleHookPtr =
67+ std::make_unique<HOOK_CALLBACK_FN>(Hy3Layout::windowGroupUpdateRecursiveHook);
68+std::unique_ptr<HOOK_CALLBACK_FN> urgentHookPtr =
69+ std::make_unique<HOOK_CALLBACK_FN>(Hy3Layout::windowGroupUrgentHook);
70+std::unique_ptr<HOOK_CALLBACK_FN> tickHookPtr =
71+ std::make_unique<HOOK_CALLBACK_FN>(Hy3Layout::tickHook);
72
73 bool performContainment(Hy3Node& node, bool contained, CWindow* window) {
74 if (node.data.type == Hy3NodeType::Group) {
75@@ -102,8 +103,8 @@ void Hy3Layout::onWindowCreatedTiling(CWindow* window, eDirection) {
76
77 // opening_after->parent cannot be nullptr
78 if (opening_after == root) {
79- opening_after
80- = opening_after->intoGroup(Hy3GroupLayout::SplitH, GroupEphemeralityOption::Standard);
81+ opening_after =
82+ opening_after->intoGroup(Hy3GroupLayout::SplitH, GroupEphemeralityOption::Standard);
83 }
84 }
85 }
86@@ -130,7 +131,8 @@ void Hy3Layout::onWindowCreatedTiling(CWindow* window, eDirection) {
87 opening_into = opening_after->parent;
88 } else {
89 if ((opening_into = this->getWorkspaceRootGroup(window->m_iWorkspaceID)) == nullptr) {
90- static const auto* tab_first_window = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tab_first_window")->intValue;
91+ static const auto* tab_first_window =
92+ &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tab_first_window")->intValue;
93
94 this->nodes.push_back({
95 .data = Hy3GroupLayout::SplitH,
96@@ -144,12 +146,12 @@ void Hy3Layout::onWindowCreatedTiling(CWindow* window, eDirection) {
97 auto& parent = this->nodes.back();
98
99 this->nodes.push_back({
100- .parent = &parent,
101- .data = Hy3GroupLayout::Tabbed,
102- .position = parent.position,
103- .size = parent.size,
104- .workspace_id = window->m_iWorkspaceID,
105- .layout = this,
106+ .parent = &parent,
107+ .data = Hy3GroupLayout::Tabbed,
108+ .position = parent.position,
109+ .size = parent.size,
110+ .workspace_id = window->m_iWorkspaceID,
111+ .layout = this,
112 });
113
114 parent.data.as_group.children.push_back(&this->nodes.back());
115@@ -239,8 +241,8 @@ void Hy3Layout::onWindowCreatedTiling(CWindow* window, eDirection) {
116 }
117
118 void Hy3Layout::onWindowRemovedTiling(CWindow* window) {
119- static const auto* node_collapse_policy
120- = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:node_collapse_policy")->intValue;
121+ static const auto* node_collapse_policy =
122+ &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:node_collapse_policy")->intValue;
123
124 auto* node = this->getNodeFromWindow(window);
125
126@@ -329,8 +331,8 @@ void Hy3Layout::recalculateMonitor(const int& monitor_id) {
127
128 if (top_node != nullptr) {
129 top_node->position = monitor->vecPosition + monitor->vecReservedTopLeft;
130- top_node->size
131- = monitor->vecSize - monitor->vecReservedTopLeft - monitor->vecReservedBottomRight;
132+ top_node->size =
133+ monitor->vecSize - monitor->vecReservedTopLeft - monitor->vecReservedBottomRight;
134 top_node->recalcSizePosRecursive();
135 }
136 }
137@@ -369,8 +371,8 @@ void Hy3Layout::recalculateMonitor(const int& monitor_id) {
138
139 if (top_node != nullptr) {
140 top_node->position = monitor->vecPosition + monitor->vecReservedTopLeft;
141- top_node->size
142diff --git a/src/Hy3Node.cpp b/src/Hy3Node.cpp
143index 9ed6add870fe94221a130dd95d8d7ea5fc944626..f4304de6bf0e1f5e9123dea10dada122c0986b90 100644
144--- a/src/Hy3Node.cpp
145+++ b/src/Hy3Node.cpp
146@@ -3,8 +3,8 @@
147 #include <hyprland/src/Compositor.hpp>
148 #include <hyprland/src/plugins/PluginAPI.hpp>
149
150-#include "globals.hpp"
151 #include "Hy3Node.hpp"
152+#include "globals.hpp"
153
154 // Hy3GroupData //
155
156@@ -310,15 +310,14 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
157 }
158
159 auto expand_focused = group->expand_focused != ExpandFocusType::NotExpanded;
160- bool directly_contains_expanded
161- = expand_focused
162- && (group->focused_child->data.type == Hy3NodeType::Window
163- || group->focused_child->data.as_group.expand_focused == ExpandFocusType::NotExpanded);
164+ bool directly_contains_expanded =
165+ expand_focused
166+ && (group->focused_child->data.type == Hy3NodeType::Window
167+ || group->focused_child->data.as_group.expand_focused == ExpandFocusType::NotExpanded);
168
169 auto child_count = group->children.size();
170- double ratio_mul = group->layout != Hy3GroupLayout::Tabbed
171- ? child_count <= 0 ? 0 : constraint / child_count
172- : 0;
173+ double ratio_mul =
174+ group->layout != Hy3GroupLayout::Tabbed ? child_count <= 0 ? 0 : constraint / child_count : 0;
175
176 double offset = 0;
177
178@@ -435,8 +434,8 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
179 child->size = tsize;
180 child->hidden = this->hidden || expand_focused || group->focused_child != child;
181
182- child->gap_topleft_offset
183- = Vector2D(gap_topleft_offset.x, gap_topleft_offset.y + tab_height_offset);
184+ child->gap_topleft_offset =
185+ Vector2D(gap_topleft_offset.x, gap_topleft_offset.y + tab_height_offset);
186 child->gap_bottomright_offset = gap_bottomright_offset;
187
188 child->recalcSizePosRecursive(no_animation);
189diff --git a/src/SelectionHook.cpp b/src/SelectionHook.cpp
190index 29bffc0b12f2a19ef4be111701300c97c9e8db19..603ede6f8069f8e2c383c5550a557274ad08c249 100644
191--- a/src/SelectionHook.cpp
192+++ b/src/SelectionHook.cpp
193@@ -22,8 +22,8 @@ void hook_updateDecos(void* thisptr, CWindow* window) {
194 }
195
196 void init() {
197- static const auto decoUpdateCandidates
198- = HyprlandAPI::findFunctionsByName(PHANDLE, "updateWindowAnimatedDecorationValues");
199+ static const auto decoUpdateCandidates =
200+ HyprlandAPI::findFunctionsByName(PHANDLE, "updateWindowAnimatedDecorationValues");
201
202 if (decoUpdateCandidates.size() != 1) {
203 g_LastSelectionHook = nullptr;
204diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
205index bbfcc5b12f6b78aa29a8ec8dbc460d824b40c2d5..8c033034c3945d0454ee606c7b88458a4aa2974b 100644
206--- a/src/TabGroup.cpp
207+++ b/src/TabGroup.cpp
208@@ -1,14 +1,13 @@
209+#include "TabGroup.hpp"
210+
211 #include <cairo/cairo.h>
212 #include <hyprland/src/Compositor.hpp>
213 #include <hyprland/src/helpers/Color.hpp>
214-#include <hyprland/src/plugins/PluginAPI.hpp>
215 #include <hyprland/src/render/OpenGL.hpp>
216 #include <pango/pangocairo.h>
217 #include <pixman.h>
218
219 #include "globals.hpp"
220-#include "Hy3Layout.hpp"
221-#include "TabGroup.hpp"
222
223 Hy3TabBarEntry::Hy3TabBarEntry(Hy3TabBar& tab_bar, Hy3Node& node): tab_bar(tab_bar), node(node) {
224 this->focused.create(
225@@ -342,10 +341,10 @@ exitloop:
226 continue;
227 }
228
229- auto moved
230- = std::find_if(removed_entries.begin(), removed_entries.end(), [&node](auto entry) {
231- return **node == *entry;
232- });
233+ auto moved =
234+ std::find_if(removed_entries.begin(), removed_entries.end(), [&node](auto entry) {
235+ return **node == *entry;
236+ });
237
238 if (moved != removed_entries.end()) {
239 this->entries.splice(entry, this->entries, *moved);
240@@ -451,8 +450,8 @@ Hy3TabGroup::Hy3TabGroup(Hy3Node& node) {
241 void Hy3TabGroup::updateWithGroup(Hy3Node& node, bool warp) {
242 static const auto* gaps_in = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_in")->intValue;
243 static const auto* gaps_out = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_out")->intValue;
244- static const auto* bar_height
245- = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:height")->intValue;
246+ static const auto* bar_height =
247+ &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:height")->intValue;
248
249 auto gaps = node.parent == nullptr ? *gaps_out : *gaps_in;
250 auto tpos = node.position + Vector2D(gaps, gaps) + node.gap_topleft_offset;
251@@ -478,10 +477,10 @@ void Hy3TabGroup::updateWithGroup(Hy3Node& node, bool warp) {
252 }
253
254 void Hy3TabGroup::tick() {
255- static const auto* enter_from_top
256- = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:from_top")->intValue;
257- static const auto* padding
258- = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:padding")->intValue;
259+ static const auto* enter_from_top =
260+ &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:from_top")->intValue;
261+ static const auto* padding =
262+ &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:padding")->intValue;
263 auto* workspace = g_pCompositor->getWorkspaceByID(this->workspace_id);
264
265 this->bar.tick();
266@@ -522,12 +521,12 @@ void Hy3TabGroup::tick() {
267 }
268
269 void Hy3TabGroup::renderTabBar() {
270- static const auto* window_rounding
271- = &HyprlandAPI::getConfigValue(PHANDLE, "decoration:rounding")->intValue;
272- static const auto* enter_from_top
273- = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:from_top")->intValue;
274- static const auto* padding
275- = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:padding")->intValue;
276+ static const auto* window_rounding =
277+ &HyprlandAPI::getConfigValue(PHANDLE, "decoration:rounding")->intValue;
278+ static const auto* enter_from_top =
279+ &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:from_top")->intValue;
280+ static const auto* padding =
281+ &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:padding")->intValue;
282
283 auto* monitor = g_pHyprOpenGL->m_RenderData.pMonitor;
284 auto* workspace = g_pCompositor->getWorkspaceByID(this->workspace_id);
285@@ -601,8 +600,8 @@ void Hy3TabGroup::renderTabBar() {
286 glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
287 }
288
289- auto fade_opacity
290- = this->bar.fade_opacity.fl() * (workspace == nullptr ? 1.0 : workspace->m_fAlpha.fl());
291+ auto fade_opacity =
292+ this->bar.fade_opacity.fl() * (workspace == nullptr ? 1.0 : workspace->m_fAlpha.fl());
293
294 auto render_entry = [&](Hy3TabBarEntry& entry) {
295 Vector2D entry_pos = {
296diff --git a/src/TabGroup.hpp b/src/TabGroup.hpp
297index 04952762464e522aed0540cecce0d72c3a37480c..e0deb481e768d9e943bc6f7d25cc12aa59362c12 100644
298--- a/src/TabGroup.hpp
299+++ b/src/TabGroup.hpp
300@@ -7,6 +7,7 @@ class Hy3TabBar;
301 #include <memory>
302 #include <vector>
303
304+#include <hyprland/src/plugins/PluginAPI.hpp>
305 #include <hyprland/src/render/Texture.hpp>
306
307 #include "Hy3Node.hpp"
308diff --git a/src/globals.hpp b/src/globals.hpp
309index 87b62962ef30d561ee23667ce67aad44fa1088a0..f2032d9754909a6250efaf07a61a3953e5fb8b30 100644
310--- a/src/globals.hpp
311+++ b/src/globals.hpp
312@@ -1,10 +1,10 @@
313 #pragma once
314
315+#include <hyprland/src/plugins/PluginAPI.hpp>
316+
317 #include "Hy3Layout.hpp"
318 #include "log.hpp"
319
320-#include <hyprland/src/plugins/PluginAPI.hpp>
321-
322 inline HANDLE PHANDLE = nullptr;
323 inline std::unique_ptr<Hy3Layout> g_Hy3Layout;
324
325diff --git a/src/main.cpp b/src/main.cpp
326index 12944a2a8483271d75c82b8e24de61b02f6f329b..f4e9c9e158f009b6951dca4e0b0bf1919e056c63 100644
327--- a/src/main.cpp
328+++ b/src/main.cpp
329@@ -3,9 +3,9 @@
330 #include <hyprland/src/Compositor.hpp>
331 #include <hyprland/src/plugins/PluginAPI.hpp>
332
333+#include "SelectionHook.hpp"
334 #include "dispatchers.hpp"
335 #include "globals.hpp"
336-#include "SelectionHook.hpp"
337
338 APICALL EXPORT std::string PLUGIN_API_VERSION() { return HYPRLAND_API_VERSION; }
339