From 2aa27fc051cc83f7d44af2a8f97472b14c52a40d Mon Sep 17 00:00:00 2001 From: WarmUpTill <19472752+WarmUpTill@users.noreply.github.com> Date: Sun, 7 Jun 2026 00:15:47 +0200 Subject: [PATCH] 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. --- lib/linux/advanced-scene-switcher-nix.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/linux/advanced-scene-switcher-nix.cpp b/lib/linux/advanced-scene-switcher-nix.cpp index 6d91c5d6..46a2ef50 100644 --- a/lib/linux/advanced-scene-switcher-nix.cpp +++ b/lib/linux/advanced-scene-switcher-nix.cpp @@ -294,6 +294,26 @@ std::vector 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; }