Diff
1diff --git a/src/Hy3Node.cpp b/src/Hy3Node.cpp
2index 1e46c12c92d3efd822323e9acb9ae964678acae2..8cde6f5d753b22a4a0eaecf97ae22e82a0f639b6 100644
3--- a/src/Hy3Node.cpp
4+++ b/src/Hy3Node.cpp
5@@ -909,6 +909,16 @@ Hy3Node* Hy3Node::getImmediateSibling(ShiftDirection direction) {
6 return *list_sibling;
7 }
8
9+CMonitor* Hy3Node::getMonitor() {
10+ if (this->data.is_window()) {
11+ return this->data.as_window()->m_monitor.get();
12+ } else {
13+ auto& group = this->data.as_group();
14+ if (group.children.empty()) return nullptr;
15+ else return group.children.front()->getMonitor();
16+ }
17+}
18+
19 Axis getAxis(Hy3GroupLayout layout) {
20 switch (layout) {
21 case Hy3GroupLayout::SplitH: return Axis::Horizontal;
22diff --git a/src/Hy3Node.hpp b/src/Hy3Node.hpp
23index af5c1788de4c186fe2415d2b45fe685b954b1e57..34b4ad90c19fa73f85a44dd654adc0900adef91f 100644
24--- a/src/Hy3Node.hpp
25+++ b/src/Hy3Node.hpp
26@@ -104,6 +104,7 @@ struct Hy3Node {
27 Hy3Node* getFocusedNode(bool ignore_group_focus = false, bool stop_at_expanded = false);
28 Hy3Node* findNeighbor(ShiftDirection);
29 Hy3Node* getImmediateSibling(ShiftDirection);
30+ CMonitor* getMonitor();
31 void resize(ShiftDirection, double, bool no_animation = false);
32 bool isIndirectlyFocused();
33 Hy3Node& getExpandActor();
34diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
35index 8eb5804147c6f55912af425876dd522f419e38b2..93cf7f5cd593bce35d69136a0825a06d88a9caa1 100644
36--- a/src/TabGroup.cpp
37+++ b/src/TabGroup.cpp
38@@ -439,27 +439,12 @@ void Hy3TabBar::beginDestroy() {
39 }
40
41 void Hy3TabBar::tick() {
42- auto is_on_active_monitor = [&]() {
43- auto& win = g_pCompositor->m_lastWindow;
44- if (!win) return false;
45-
46- auto& workspace = win->m_workspace;
47- if (!workspace) return false;
48-
49- auto& mon = workspace->m_monitor;
50- if (!mon) return false;
51-
52- return mon->m_id == this->monitor_id;
53- }();
54-
55 auto iter = this->entries.begin();
56
57 while (iter != this->entries.end()) {
58 if (iter->shouldRemove()) {
59 iter = this->entries.erase(iter);
60 } else {
61- iter->setMonitorActive(is_on_active_monitor);
62-
63 if (iter->active_monitor->isBeingAnimated()) {
64 this->dirty = true;
65 }
66@@ -536,9 +521,11 @@ exitloop:
67 parent_group.focused_child == *node || (parent_group.group_focused && parent_focused)
68 );
69
70- entry->setActive(
71- parent_focused && (parent_group.focused_child == *node || parent_group.group_focused)
72- );
73+ auto active = parent_focused && (parent_group.focused_child == *node || parent_group.group_focused);
74+ entry->setActive(active);
75+
76+ auto& last_monitor = g_pCompositor->m_lastMonitor;
77+ entry->setMonitorActive(active && (!last_monitor || (*node)->getMonitor() == last_monitor.get()));
78
79 entry->setUrgent((*node)->isUrgent());
80 entry->setWindowTitle((*node)->getTitle());