Skip to content

Commit f968eb2

Browse files
committed
fix(hyprland): scope ext taskbar toplevels to the bar output
1 parent d835e54 commit f968eb2

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

src/compositors/compositor_platform.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ namespace compositors {
4545
namespace {
4646

4747
void appendHyprlandExtOnlyWindows(std::vector<ToplevelInfo>& windows, const std::vector<ToplevelInfo>& extWindows,
48-
const compositors::hyprland::HyprlandToplevelMapping& mapping) {
48+
const compositors::hyprland::HyprlandToplevelMapping& mapping,
49+
const std::unordered_set<std::string>* outputWindowIds) {
4950
std::unordered_set<std::string> wlrRepresentedIds;
5051
wlrRepresentedIds.reserve(windows.size());
5152
for (const auto& window : windows) {
@@ -74,6 +75,12 @@ namespace {
7475
if (!normalized.empty() && wlrRepresentedIds.contains(normalized)) {
7576
continue;
7677
}
78+
// ext_foreign_toplevel_list has no per-output metadata; scope to this bar's monitor via IPC.
79+
if (outputWindowIds != nullptr && (normalized.empty() || !outputWindowIds->contains(normalized))) {
80+
continue;
81+
}
82+
} else if (outputWindowIds != nullptr) {
83+
continue;
7784
}
7885
windows.push_back(extWindow);
7986
}
@@ -421,7 +428,18 @@ std::vector<ToplevelInfo> CompositorPlatform::windowsForApp(const std::string& i
421428
return windows;
422429
}
423430

424-
appendHyprlandExtOnlyWindows(windows, m_wayland.extWindowsForApp(idLower, wmClassLower), *m_hyprlandToplevelMapping);
431+
std::unordered_set<std::string> outputWindowIds;
432+
if (outputFilter != nullptr && m_workspaces != nullptr) {
433+
for (const auto& row : m_workspaces->workspaceWindows(outputFilter)) {
434+
const auto normalized = compositors::hyprland::normalizeWindowId(row.windowId);
435+
if (!normalized.empty()) {
436+
outputWindowIds.insert(normalized);
437+
}
438+
}
439+
}
440+
441+
appendHyprlandExtOnlyWindows(windows, m_wayland.extWindowsForApp(idLower, wmClassLower), *m_hyprlandToplevelMapping,
442+
outputFilter != nullptr ? &outputWindowIds : nullptr);
425443
return windows;
426444
}
427445

0 commit comments

Comments
 (0)