workspace: Don't activate desktop window when it gets added

Unless there is no focus window. Matches X11 behavior.

Otherwise (re)starting plasmashell would pull focus away from
whatever window is currently focussed.
This commit is contained in:
Kai Uwe Broulik 2023-08-22 13:06:53 +02:00
parent ef41fa8e8f
commit ba8c52564e

View file

@ -827,9 +827,13 @@ void Workspace::addWaylandWindow(Window *window)
if (window->wantsInput() && !window->isMinimized()) {
// Never activate a window on its own in "Extreme" mode.
if (options->focusStealingPreventionLevel() < 4) {
if (!window->isDesktop()
// If there's no active window, make this desktop the active one.
|| (activeWindow() == nullptr && should_get_focus.count() == 0)) {
activateWindow(window);
}
}
}
updateTabbox();
Q_EMIT windowAdded(window);
}