One of the most interesting things about Wayland is how it handles window focus, unlike X11, where focus stealing can be frustrating and even a security risk. Its main advantage is a mechanism that prevents focus stealing. The protocol that plays a role in this is known as "XDG Activation." This works by having an app request a unique token from the compositor. The compositor can create this token in response to user input. The new application then presents the token to get focus, which is granted if the token is valid and the request is deemed appropriate. If it's denied, the window is marked as "needs attention," and that's when you see a flashing icon on the taskbar. Flashing icon in the taskbar | Image: Kai-Uwe Broulik Kai-Uwe Broulik, a KDE developer, recently wrote about the plan to "switch on KWin’s focus stealing on Wayland at a low level". This means KWin, the window manager for KDE Plasma, will begin enforcing this properly. Under X11, new or dialog windows can only grab focus if their application was most recently active, a check often based on a timestamp called _NET_WM_USER_TIME. It was a flimsy system at best. For example, Kai cited how the prevention logic on X11 would sometimes stop the Adobe Flash Player fullscreen window from showing on top of a YouTube video. On X11, an application could just call XSetInputFocus on another app's window, and while KWin would try to undo it, focus did flicker for a moment. Over on Wayland, things are much better with XDG Activation, but some apps still violate the protocol through improper usage. In situations like that, KWin would, by default, just focus any new window that opened. This is changing. A new "Extreme" setting for "Focus Stealing Prevention" in the Window Management settings will force KWin to activate a window if and only if it requests activation with a valid token. Image: Kai-Uwe BroulikUsing this stricter mode, developers Xaver Hugl and Kai-Uwe Broulik have already fixed a ton of issues, introducin...
First seen: 2025-08-04 13:29
Last seen: 2025-08-04 16:30