Fix window conditions not triggering for native Wayland windows

When KWin compat is active, GetWindows() only returned XWayland windows
since it relied on X11's _NET_CLIENT_LIST. Native Wayland windows were
invisible to conditions even though GetCurrentWindowTitle() reported them
correctly via the KWin DBus notifier.
This commit is contained in:
WarmUpTill 2026-06-07 00:15:47 +02:00 committed by WarmUpTill
parent 31b239d5dc
commit 2aa27fc051

View File

@ -294,6 +294,26 @@ std::vector<WindowInfo> GetWindows(const WindowQueryOptions &options)
result.emplace_back(std::move(info));
}
// When KWin compat is active, native Wayland windows are not tracked by
// X11 and therefore do not appear in the list above. If the currently
// focused window (reported via KWin DBus) is not already present, add it
// so that title and focus conditions can match native Wayland windows.
if (KWin && !foregroundTitle.empty()) {
bool found = false;
for (const auto &info : result) {
if (info.title == foregroundTitle) {
found = true;
break;
}
}
if (!found) {
WindowInfo waylandWindow;
waylandWindow.title = foregroundTitle;
waylandWindow.focused = true;
result.emplace_back(std::move(waylandWindow));
}
}
return result;
}