Bug 504165 - Electron app (XWayland) steals focus from native Wayland window after another X11 window closes
Summary: Electron app (XWayland) steals focus from native Wayland window after another...
Status: RESOLVED DUPLICATE of bug 490057
Alias: None
Product: kwin
Classification: Plasma
Component: xwayland (other bugs)
Version First Reported In: 6.3.5
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-13 17:02 UTC by steemandlinux
Modified: 2025-05-14 12:15 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description steemandlinux 2025-05-13 17:02:14 UTC
Summary:
Electron apps running under XWayland incorrectly regain focus after another XWayland window is closed, even when a native Wayland window should become active.

Steps to reproduce:

Launch an Electron application (running via XWayland).

Launch a second XWayland application.

In between, ensure there's a native Wayland window (e.g., Dolphin or a web browser) that was active before.

Close the second XWayland application.

Expected behavior:
The previously active Wayland-native window (Dolphin or browser) should regain focus.

Actual behavior:
The first Electron app (running on XWayland) becomes active and receives focus, even though it wasn't the last active window.

Additional notes:

This issue only occurs with Electron apps running under XWayland. Other XWayland clients (like xterm, xwayland ran chromium, wine) do not cause this behavior.

If the same Electron app is launched using native Wayland (--ozone-platform=wayland), the issue does not occur.

This suggests the problem may be related to how Electron/Chromium handles background/foreground state under X11, possibly requesting focus incorrectly.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
KDE Plasma Version: 6.3
KDE Frameworks Version: 6.13 
Qt Version: 6.9
Comment 1 steemandlinux 2025-05-14 11:19:07 UTC
Oh, I'm sorry my security settings were allowing  XWayland to handle mouse outside of the XWayland. Shall I close the bugreport?
Comment 2 Zamundaaa 2025-05-14 12:15:27 UTC
You can work around it by disabling that setting, but it's still a pretty bad bug that should be fixed.

*** This bug has been marked as a duplicate of bug 490057 ***