Bug 498588 - KWrite window opens in background when opening files from Dolphin
Summary: KWrite window opens in background when opening files from Dolphin
Status: ASSIGNED
Alias: None
Product: kate
Classification: Applications
Component: kwrite (show other bugs)
Version: 24.12.0
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-13 08:03 UTC by Ingo Klöcker
Modified: 2025-01-19 17:33 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ingo Klöcker 2025-01-13 08:03:03 UTC
KWrite window opens in background when opening files from Dolphin.

STEPS TO REPRODUCE
1. Select some text file(s) in Dolphin and choose Open with KWrite in the context menu

OBSERVED RESULT
KWrite opens, but the window is behind Dolphin.

This is a regression. It didn't happen in 24.08.

Note: Sometimes KWrite opens in the foreground. I didn't find a pattern, but the very first KWrite opened from Dolphin after login always opens in the background.
Note 2 (just for completeness; I don't see how this could possibly related to the bug): A few KWrite instances are opened/restored via session management. They are restored minimized.

EXPECTED RESULT
KWrite opens and the new window is shown in front of Dolphin (and other windows).

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE Tumbleweed
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.9.0
Qt Version: 6.8.1
Comment 1 Ingo Klöcker 2025-01-13 10:37:22 UTC
In case it matters: I'm still using X11.
Comment 2 duha.bugs 2025-01-13 23:45:28 UTC
Pattern: 
If           kwrite was minimized while closing (doesn't matter if reboot or right click on the task bar and close)
Then     kwrite starts in minimized (don't think its starts in the background, just minimized)

If   kwrite was **not**  minimized while closing (doesn't matter if reboot or right click on the task bar and close)
Then     kwrite **does not** start minimized (don't think its starts in the background, just minimized)

**This is X11 only** tested against Tumblweed and Arch

Not sure if this is regression. Can you downgrade kwrite to 24.08 and check if this doesn't happen?
Comment 3 Ingo Klöcker 2025-01-14 08:20:20 UTC
I cannot downgrade to 24.08 without much hassle, but I never saw this with 24.08 (or any other older version) and I'm doing exactly the same as I've always been doing so that I surely would have noticed this problem in 24.08.
Comment 4 duha.bugs 2025-01-14 19:53:30 UTC
Just so I do not misunderstand:
Does you kwrite start minimized or just in the background?
Comment 5 Ingo Klöcker 2025-01-14 21:22:43 UTC
It does indeed start minimized. Probably because I have a few minimized KWrite instances that are saved and restored by session management.
Comment 6 duha.bugs 2025-01-14 23:08:37 UTC
This SEEMS like intended behavior. The window state (minimized, maximized, ..) gets saved to ~/.local/share/kwrite/anonymous.katesession
Eg.: WindowState=1 when kwrite gets closed. Same for Kate.

What I don't know if this SHOULD be the the intended behavior, therefore I let the kwrite/Kate maintainers confirm or close this bug.
Comment 7 Waqar Ahmed 2025-01-15 04:22:23 UTC
Maybe because of https://invent.kde.org/frameworks/kxmlgui/-/merge_requests/239

Windows state restoration was broken for quite sometime
Comment 8 Ingo Klöcker 2025-01-15 07:55:50 UTC
I very much doubt that it is intended behavior that a *new* instance of kwrite started by direct user interaction is started minimized. Only kwrite instances that are restored by session management should be started minimized if they were minimized when the last session was saved.
Comment 9 Christoph Cullmann 2025-01-16 19:18:51 UTC
Yes, that is not the intended behavior.
Comment 10 Bug Janitor Service 2025-01-19 17:33:10 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/1697
Comment 11 Christoph Cullmann 2025-01-19 17:33:17 UTC
Could one try

https://invent.kde.org/utilities/kate/-/merge_requests/1697