Diff
1diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
2index caa9b2f7a57f96be0374432b9f4ee27b8b11c804..f892a83cbf523cab96f18110cb729526045f7ff4 100644
3--- a/src/TabGroup.cpp
4+++ b/src/TabGroup.cpp
5@@ -447,6 +447,11 @@ void Hy3TabGroup::updateWithGroup(Hy3Node& node, bool warp) {
6 }
7 }
8
9+void damageBox(const Vector2D* position, const Vector2D* size) {
10+ auto box = CBox {position->x, position->y, size->x, size->y};
11+ g_pHyprRenderer->damageBox(&box);
12+}
13+
14 void Hy3TabGroup::tick() {
15 static const auto enter_from_top = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:from_top");
16 static const auto padding = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:padding");
17@@ -459,14 +464,31 @@ void Hy3TabGroup::tick() {
18 } else {
19 if (this->bar.fade_opacity.goal() != 1.0) this->bar.fade_opacity = 1.0;
20 }
21+
22+ auto workspaceOffset = this->workspace->m_vRenderOffset.value();
23+ if (this->last_workspace_offset != workspaceOffset) {
24+ // First we damage the area where the bar was during the previous
25+ // tick, cleaning up after ourselves
26+ auto pos = this->last_pos + this->last_workspace_offset;
27+ auto size = this->last_size;
28+ damageBox(&pos, &size);
29+
30+ // Then we damage the current position of the bar, to avoid seeing
31+ // glitches with animations disabled
32+ pos = this->pos.value() + workspaceOffset;
33+ size = this->size.value();
34+ damageBox(&pos, &size);
35+
36+ this->bar.damaged = true;
37+ this->last_workspace_offset = workspaceOffset;
38+ }
39 }
40
41 auto pos = this->pos.value();
42 auto size = this->size.value();
43
44 if (this->last_pos != pos || this->last_size != size) {
45- CBox damage_box = {this->last_pos.x, this->last_pos.y, this->last_size.x, this->last_size.y};
46- g_pHyprRenderer->damageBox(&damage_box);
47+ damageBox(&this->last_pos, &this->last_size);
48
49 this->bar.damaged = true;
50 this->last_pos = pos;
51@@ -480,8 +502,7 @@ void Hy3TabGroup::tick() {
52 pos.y -= *padding;
53 }
54
55- CBox damage_box = {pos.x, pos.y, size.x, size.y};
56- g_pHyprRenderer->damageBox(&damage_box);
57+ damageBox(&pos, &size);
58
59 this->bar.damaged = true;
60 this->bar.dirty = false;
61diff --git a/src/TabGroup.hpp b/src/TabGroup.hpp
62index 0fe1d950e846a7ad45508f85209f28644be19099..70339c938d21c302e41fbf19cdb374547aa60bd7 100644
63--- a/src/TabGroup.hpp
64+++ b/src/TabGroup.hpp
65@@ -103,6 +103,7 @@ public:
66
67 private:
68 std::vector<PHLWINDOWREF> stencil_windows;
69+ Vector2D last_workspace_offset;
70 Vector2D last_pos;
71 Vector2D last_size;
72