Bug 460283

Summary: "Switch to instance" functionality does not cause the window for that instance to raise on Wayland
Product: [Applications] kate Reporter: Edward Oubrayrie <edoubrayrie>
Component: applicationAssignee: KWrite Developers <kwrite-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: cullmann, jonas-miles-kwecl, nate
Priority: NOR    
Version: 22.08.1   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:
Bug Depends on:    
Bug Blocks: 460318    

Description Edward Oubrayrie 2022-10-12 08:55:33 UTC
STEPS TO REPRODUCE
0. In a wayland session (tested with Plasma 5.26)
1. Start kate, minimize or hide it
2. Open kate from start menu. A window displays "Session 'x' is already opened in another Kate instance."
3. Click "Switch to instance"

Another scenario
0. In a wayland session (tested with Plasma 5.26)
1. Start kate, minimize or hide it
2. Open any kate file eg "foo.txt" from start menu.

OBSERVED RESULT
Kate window is not visible.

EXPECTED RESULT
Kate window is raised to forefront.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Neon  22.04
KDE Plasma Version: 5.25.90
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.6

ADDITIONAL INFORMATION
Xref https://invent.kde.org/plasma/kwin/-/issues/39 for more examples.
protocol https://wayland.app/protocols/xdg-activation-v1
https://invent.kde.org/system/dolphin/-/merge_requests/461 for a similar dolphin fix.
Comment 1 Nate Graham 2022-10-12 16:04:29 UTC
Can reproduce.

Kate *generally* has activation support because its open window raises as expected when a file is opened by Ctrl+clicking on a path in Konsole. But it seems to be missing for the specific piece of functionality.
Comment 2 Christoph Cullmann 2022-11-12 17:54:13 UTC
(In reply to Nate Graham from comment #1)
> Can reproduce.
> 
> Kate *generally* has activation support because its open window raises as
> expected when a file is opened by Ctrl+clicking on a path in Konsole. But it
> seems to be missing for the specific piece of functionality.

If you have some hint how to fix this on Wayland I would like to try that, but I have no clue how to do so.

The API we use atm is without effect.
Comment 3 Christoph Cullmann 2022-11-12 20:03:48 UTC
*** Bug 430754 has been marked as a duplicate of this bug. ***
Comment 4 Christoph Cullmann 2022-11-12 20:04:13 UTC
The message in the other bug stems from our use of API that no longer works.
Comment 5 Christoph Cullmann 2022-11-12 20:32:31 UTC
I got the info that one shall use

KWindowSystem::requestXdgActivationToken

and wait for

KWindowSystem::xdgActivationTokenArrived

and send this over to ensure one can activate, at least for this case.

If somebody has time to work that, that would be nice.