Bug 482999 - Window doesn't get focus when opening files in an already running app
Summary: Window doesn't get focus when opening files in an already running app
Status: RESOLVED DOWNSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (other bugs)
Version First Reported In: 6.0.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2024-03-09 15:55 UTC by neonder
Modified: 2024-08-28 10:47 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
SublimeText changelog (69.62 KB, image/png)
2024-08-20 20:29 UTC, neonder
Details

Note You need to log in before you can comment on or make changes to this bug.
Description neonder 2024-03-09 15:55:29 UTC
STEPS TO REPRODUCE
1. Set Sublime Text as default editor
2. Open a file that has it as an assigned default app (eg, text file)
3. First file opens Sublime and focuses it
4. Second file does open in it, but doesn't bring it to the top and focuses on it, but instead it loads in the background with the Sublime mini icon bouncing near mouse cursor like it's loading

OBSERVED RESULT
The window of the app doesn't get focused with the activated file

EXPECTED RESULT
The window should get into focus with the activated file show in it

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Neon Wayland
KDE Plasma Version:6.0.0 
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2

ADDITIONAL INFORMATION
Similar to https://www.reddit.com/r/gnome/comments/18kvlb7/wayland_opening_file_in_alreadyrunning_app_fails/?rdt=55071

Something similar to this, but with SublimeText
Comment 1 Nate Graham 2024-03-11 22:50:06 UTC
This is an issue in Sublime itself, which apparently lacks proper support for the xdg_activation_v1 Wayland protocol.
Comment 2 neonder 2024-08-20 20:29:35 UTC
Created attachment 172787 [details]
SublimeText changelog

An recent update to the app concerning xdg-activation protocol, but still the focus is not working properly...
I don't get it, is it still on their side, or is this something KDE related?
Comment 3 Nate Graham 2024-08-20 20:32:40 UTC
The protocol needs to be implemented for both the sending app and the receiving app, and both need to implement it properly. So it's not enough that Sublime does it, the sending app needs to as well.

What is the other app?
Comment 4 neonder 2024-08-20 20:37:27 UTC
(In reply to Nate Graham from comment #3)
> The protocol needs to be implemented for both the sending app and the
> receiving app, and both need to implement it properly. So it's not enough
> that Sublime does it, the sending app needs to as well.
> 
> What is the other app?

Dolphin.
Although weird, from my perspective, for it to not have it implemented, as it is a first class citizen in KDE.
Comment 5 Nate Graham 2024-08-20 20:44:29 UTC
Yes, Dolphin should definitely be doing the right thing here. Does it work if the receiving app is Kate, and not Sublime Text?

If that works, then the issue is in Sublime Text's implementation of the activation protocol.
Comment 6 neonder 2024-08-20 21:12:47 UTC
(In reply to Nate Graham from comment #5)
> Yes, Dolphin should definitely be doing the right thing here. Does it work
> if the receiving app is Kate, and not Sublime Text?
> 
> If that works, then the issue is in Sublime Text's implementation of the
> activation protocol.

You're correct.
Kate works properly. It only fails with Sublime Text.
I'll reach out to their devs.

Thanks!
Comment 7 Nate Graham 2024-08-20 21:13:28 UTC
You're welcome!
Comment 8 neonder 2024-08-28 10:47:19 UTC
For anyone having the same issue, here is the reason (from https://github.com/sublimehq/sublime_text/issues/6236)

"KDE Neon is based on ubuntu 22.04. While it's running the latest KDE it has pretty outdated versions of GTK (which ST uses). The version of GTK you have doesn't implement the xdg-activation protocol and so ST can't be focused."

So, until we move to the next Ubuntu LTS, this can't be fixed.