Bug 447538 - On Wayland, Kate doesn't prefer opening files in an instance on the current virtual desktop
Summary: On Wayland, Kate doesn't prefer opening files in an instance on the current v...
Status: REPORTED
Alias: None
Product: kwayland-integration
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-26 13:03 UTC by Ahmad Samir
Modified: 2024-03-05 10:27 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmad Samir 2021-12-26 13:03:30 UTC
Basically the code uses KWindowSystem::currentDesktop()[1] to check which virtual desktop you're on, and if there is a Kate instance running there already open the file in it, and if there isn't it starts a new instance then open the file with it.

The issue is that on Wayland currentDesktop() always returns 0, so the logic doesn't work, opening a file with Kate could end up opening that file on an instance that's already running on a different virtual desktop.

[1]https://invent.kde.org/utilities/kate/-/blob/master/kate/main.cpp#L407
Comment 1 Christoph Cullmann 2022-01-08 18:59:02 UTC
I would consider this more an issue of the kwayland-integration.
Or is there some replacement function for this?
Comment 2 Ahmad Samir 2022-01-08 19:12:25 UTC
The fix will probably have to be somewhere in kwayland*, then we can use it in Kate.
Comment 3 Nicolas Fella 2022-12-21 12:25:50 UTC
As of right now upstream Wayland has no concept of virtual desktops. That means that the existing virtual desktops in e.g. Plasma are completely compositor-defined and applications generally have no information about what desktop they are on. 

There may or may no come a Wayland protocol that allows this in the future, but as of right now this part of KWindowSystem can't reasonably be implemented on Wayland.

That's why https://invent.kde.org/frameworks/kwindowsystem/-/merge_requests/72 renames it to make this explicit
Comment 4 Ahmad Samir 2024-03-05 10:27:25 UTC
I don't know much about Wayland; so here is an observation, assuming there is a kate instance on the current virtual desktop, and focus stealing prevention is set to none:
- Ctrl+Clicking in konsole opens the file in that kate instance and activates the window
- From that konsole window, using `kate /path/to/some/file`, the file is opened in kate, but the window isn't activated, and the task manager highlights the kate window as requesting attention