From a40dd9a1586c768ee956f193d2d70ec5e66c2cbe Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Sat, 31 Dec 2022 00:59:29 +0100 Subject: [PATCH] Only make startup notification change the virtual desktop if requested Startup notifications optionally contain the target desktop the app should be launched to. If present the window is sent to that desktop, if not it is sent to the current desktop. Later in Workspace::activateWindow we check if the window is on the current desktop, and if not we either move it to the current desktop or switch to the window's desktop depending on user preference. However, this is broken because the window was already moved to the current desktop. To avoid this only move the window if specifically requested by the startup id. BUG: 462996 --- src/activation.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/activation.cpp b/src/activation.cpp index 530d3a9d2e..cf37db68e5 100644 --- a/src/activation.cpp +++ b/src/activation.cpp @@ -767,13 +767,11 @@ void X11Window::startupIdChanged() // If the ASN contains desktop, move it to the desktop, otherwise move it to the current // desktop (since the new ASN should make the window act like if it's a new application // launched). However don't affect the window's desktop if it's set to be on all desktops. - int desktop = VirtualDesktopManager::self()->current(); - if (asn_data.desktop() != 0) { - desktop = asn_data.desktop(); - } - if (!isOnAllDesktops()) { - workspace()->sendWindowToDesktop(this, desktop, true); + + if (asn_data.desktop() != 0 && !isOnAllDesktops()) { + workspace()->sendWindowToDesktop(this, asn_data.desktop(), true); } + if (asn_data.xinerama() != -1) { Output *output = workspace()->xineramaIndexToOutput(asn_data.xinerama()); if (output) { @@ -783,9 +781,6 @@ void X11Window::startupIdChanged() const xcb_timestamp_t timestamp = asn_id.timestamp(); if (timestamp != 0) { bool activate = allowWindowActivation(timestamp); - if (asn_data.desktop() != 0 && !isOnCurrentDesktop()) { - activate = false; // it was started on different desktop than current one - } if (activate) { workspace()->activateWindow(this); } else {