Make use of KWindowSystem::setMainWindow
It supports XDG Foreign nowadays. More importantly, from Qt 6.8 it makes use of the surfaceRoleCreated interface to do the import before the window is actually shown, keeping it from flashing in task bar briefly.
And red patches are the best patches
- In Dolphin, did “Open With”, dialog would no longer flash briefly in task bar.
However, sometimes the Dolphin would show up orange (demanding attention) and I don’t fully understand why. Could be a bug in the waylandtasksmodel since it forwards the attention status of children to their parent. Focussing a different window and back doesn’t remove the state from the model.