Bug 481574

Summary: Sending a window to another workspace leaves no windows focused on the current workspace
Product: [Plasma] kwin Reporter: Mariusz Libera <mariusz.libera>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: firlaevhans.fiete, kde, miranda, nate, postix, vlad.zahorodnii
Priority: VHI Keywords: accessibility, usability
Version: 5.93.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 6.2.0
Sentry Crash Report:

Description Mariusz Libera 2024-02-20 11:03:34 UTC
STEPS TO REPRODUCE
1. have at least 2 virtual desktops
2. open 2 konsole windows on desktop 1
3. right click the title bar of the focused konsole window and select 'move to desktop 2'

OBSERVED RESULT
4. the other konsole window is not focused

EXPECTED RESULT
4. the other konsole window is focused

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.93.0
KDE Frameworks Version: 5.249.0
Qt Version: 6.7.0
Kernel Version: 6.7.5-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 6800H with Radeon Graphics
Memory: 14.8 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Manufacturer: LENOVO
Product Name: 82RE
System Version: Legion 5 15ARH7

ADDITIONAL INFORMATION
It's the same, if I use the keyboard shortcut.
Comment 1 Nate Graham 2024-02-21 18:01:18 UTC
Are you saying you want it to move there, and also switch to that virtual desktop as well? Because it can't focus the window when the window goes to another virtual desktop without switching to that virtual desktop.
Comment 2 Bug Janitor Service 2024-03-07 03:46:43 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 3 Mariusz Libera 2024-03-08 13:23:16 UTC
(In reply to Nate Graham from comment #1)
> Are you saying you want it to move there, and also switch to that virtual
> desktop as well? Because it can't focus the window when the window goes to
> another virtual desktop without switching to that virtual desktop.

No, at no point do I want to switch desktops. This is about focus. If you have 2 windows open and you close the one with focus, the other one now gains focus - this does not work, if instead of closing the focused window you send it to another desktop - the remaining window is not focused.
Comment 4 Nate Graham 2024-03-08 21:25:34 UTC
Got it. Can reproduce that.
Comment 5 David Edmundson 2024-08-07 09:14:37 UTC
not only that the previous window is still focussed, that's bad.
Comment 6 Bug Janitor Service 2024-08-07 14:29:04 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/6212
Comment 7 Firlaev-Hans 2024-08-12 09:56:46 UTC
*** Bug 450405 has been marked as a duplicate of this bug. ***
Comment 8 David Edmundson 2024-09-16 10:30:01 UTC
Git commit b96e6cf0b3eb4250b7a9ed6f5c1c7fa080566dd0 by David Edmundson.
Committed on 16/09/2024 at 10:20.
Pushed by davidedmundson into branch 'master'.

workspace: Update focus when a window is moved away from the current desktop

If a focussed window is to a new virtual desktop we need to update focus. It
does not make sense for focus to remain on a now-invisible window. This patch
re-uses the same path as when virtual desktop is changed.

M  +7    -0    autotests/integration/kwinbindings_test.cpp
M  +9    -2    src/workspace.cpp
M  +1    -1    src/workspace.h

https://invent.kde.org/plasma/kwin/-/commit/b96e6cf0b3eb4250b7a9ed6f5c1c7fa080566dd0
Comment 9 Vlad Zahorodnii 2024-09-17 08:45:31 UTC
Git commit 8e20932d3f13a4c085c80cf316df3aa910cdff0e by Vlad Zahorodnii, on behalf of David Edmundson.
Committed on 17/09/2024 at 08:03.
Pushed by vladz into branch 'Plasma/6.2'.

workspace: Update focus when a window is moved away from the current desktop

If a focussed window is to a new virtual desktop we need to update focus. It
does not make sense for focus to remain on a now-invisible window. This patch
re-uses the same path as when virtual desktop is changed.


(cherry picked from commit b96e6cf0b3eb4250b7a9ed6f5c1c7fa080566dd0)

Co-authored-by: David Edmundson <kde@davidedmundson.co.uk>

M  +7    -0    autotests/integration/kwinbindings_test.cpp
M  +9    -2    src/workspace.cpp
M  +1    -1    src/workspace.h

https://invent.kde.org/plasma/kwin/-/commit/8e20932d3f13a4c085c80cf316df3aa910cdff0e