Diff
1diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
2index 4c4a9d5d9347805f6076f17acb70801bb44d3a53..24b9e6ae9b050d6e527512479663aa52219036ed 100644
3--- a/src/TabGroup.cpp
4+++ b/src/TabGroup.cpp
5@@ -409,14 +409,6 @@ Hy3TabGroup::Hy3TabGroup(Hy3Node& node) {
6 this->size.warp();
7 }
8
9-void Hy3TabGroup::damage() {
10- auto pos = this->node->position;
11- auto size = this->node->size;
12- auto box = CBox {pos.x, pos.y, size.x, size.y};
13-
14- g_pHyprRenderer->damageBox(&box);
15-}
16-
17 void Hy3TabGroup::updateWithGroup(Hy3Node& node, bool warp) {
18 this->node = &node;
19
20@@ -453,6 +445,11 @@ void Hy3TabGroup::updateWithGroup(Hy3Node& node, bool warp) {
21 }
22 }
23
24+void damageBox(const Vector2D* position, const Vector2D* size) {
25+ auto box = CBox {position->x, position->y, size->x, size->y};
26+ g_pHyprRenderer->damageBox(&box);
27+}
28+
29 void Hy3TabGroup::tick() {
30 static const auto enter_from_top = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:from_top");
31 static const auto padding = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:padding");
32@@ -466,8 +463,22 @@ void Hy3TabGroup::tick() {
33 if (this->bar.fade_opacity.goal() != 1.0) this->bar.fade_opacity = 1.0;
34 }
35
36- if (this->workspace->m_vRenderOffset.isBeingAnimated()) {
37- this->damage();
38+ auto workspaceOffset = this->workspace->m_vRenderOffset.value();
39+ if (this->last_workspace_offset != workspaceOffset) {
40+ // First we damage the area where the bar was during the previous
41+ // tick, cleaning up after ourselves
42+ auto pos = this->last_pos + this->last_workspace_offset;
43+ auto size = this->last_size;
44+ damageBox(&pos, &size);
45+
46+ // Then we damage the current position of the bar, to avoid seeing
47+ // glitches with animations disabled
48+ pos = this->pos.value() + workspaceOffset;
49+ size = this->size.value();
50+ damageBox(&pos, &size);
51+
52+ this->bar.damaged = true;
53+ this->last_workspace_offset = workspaceOffset;
54 }
55 }
56
57@@ -475,8 +486,7 @@ void Hy3TabGroup::tick() {
58 auto size = this->size.value();
59
60 if (this->last_pos != pos || this->last_size != size) {
61- CBox damage_box = {this->last_pos.x, this->last_pos.y, this->last_size.x, this->last_size.y};
62- g_pHyprRenderer->damageBox(&damage_box);
63+ damageBox(&this->last_pos, &this->last_size);
64
65 this->bar.damaged = true;
66 this->last_pos = pos;
67@@ -490,8 +500,7 @@ void Hy3TabGroup::tick() {
68 pos.y -= *padding;
69 }
70
71- CBox damage_box = {pos.x, pos.y, size.x, size.y};
72- g_pHyprRenderer->damageBox(&damage_box);
73+ damageBox(&pos, &size);
74
75 this->bar.damaged = true;
76 this->bar.dirty = false;
77diff --git a/src/TabGroup.hpp b/src/TabGroup.hpp
78index 910b304b7ed3b1d24891da9b001f1872d251bbf2..26eda2e62531d0e47dfcfeb8710aed88aee2669d 100644
79--- a/src/TabGroup.hpp
80+++ b/src/TabGroup.hpp
81@@ -103,6 +103,7 @@ public:
82
83 private:
84 std::vector<PHLWINDOWREF> stencil_windows;
85+ Vector2D last_workspace_offset;
86 Vector2D last_pos;
87 Vector2D last_size;
88 Hy3Node* node;
89@@ -114,6 +115,4 @@ private:
90
91 // UB if node is not a group.
92 void updateStencilWindows(Hy3Node&);
93-
94- void damage();
95 };