Bug 512741 - Window size is incorrectly restored to maximized dimensions instead of pre-maximized dimensions when closed while maximized
Summary: Window size is incorrectly restored to maximized dimensions instead of pre-ma...
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: core (other bugs)
Version First Reported In: 6.5.3
Platform: Fedora RPMs Linux
: NOR major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-11-29 08:29 UTC by Mahdi Hosseini
Modified: 2025-12-05 16:56 UTC (History)
2 users (show)

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


Attachments
My journalctl Err level log file (316.84 KB, text/plain)
2025-11-29 08:34 UTC, Mahdi Hosseini
Details
Warning level logs (680.11 KB, text/plain)
2025-11-29 08:36 UTC, Mahdi Hosseini
Details
A video regarding this issue. (3.23 MB, video/webm)
2025-11-29 15:55 UTC, Mahdi Hosseini
Details
Look (3.56 MB, application/gzip)
2025-11-29 16:14 UTC, Mahdi Hosseini
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mahdi Hosseini 2025-11-29 08:29:09 UTC
Window size is incorrectly restored to maximized dimensions instead of pre-maximized dimensions when closed while maximized

Some Software like Libreoffice or Telegram Desktop does not properly save and restore the window size/state when the application is closed while maximized.

When a window is closed in the maximized state, all standard applications are expected to restore the window to its original floating (pre-maximized) size and position upon the next launch.

Instead, LibreOffice etc stores the maximized screen dimensions as the window's last known floating size.

Consequently, when the application is opened again, the window appears in a floating (un-maximized) state, but with the full size of the screen (the maximized dimensions), instead of its original small size.

This behavior is extremely annoying, especially when the maximized state was achieved on a very large monitor (like a 4K display or external monitor), as the window becomes unusable on a smaller screen upon reopening.




STEPS TO REPRODUCE
1. Open a software like libreoffice (e.g., Calc or Writer)., blender, Telegram Desktop etc  
2. Resize the window to a small, custom size (e.g., 100×200 pixels) and ensure it is not maximized (floating state).
3. Maximize the software window using the title bar button. (The size is now the screen size, e.g., 1440×900).
4. Close the document/application while it is still in the maximized state.
5. Re-open the same software.
in libreoffice,  (if you open writer at first step, you must reopen writer and not Calc or Impress)


OBSERVED RESULT
The window size, instead of being displayed at its dimensions before maximization, is shown at the maximized dimensions, even though the application itself is not maximized and is floating.

EXPECTED RESULT
It should open in its pre-maximize dimensions.
This means that if the window is 320×300 in the first step and we maximize it, after closing and reopening the window, its dimensions should be 320×300, not 1440×900, which is my monitor's resolution.

Additional Info:
Version: 25.8.3.2 (X86_64) / LibreOffice Community
Build ID: 8ca8d55c161d602844f5428fa4b58097424e324e
CPU threads: 12; OS: Linux 6.17; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Flatpak
Calc: threaded
---
Operating System: Fedora Linux 42
KDE Plasma Version: 6.5.3
KDE Frameworks Version: 6.20.0
Qt Version: 6.9.3
Kernel Version: 6.17.8-200.fc42.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × 13th Gen Intel® Core™ i5-13420H
Memory: 32 GiB of RAM (31.0 GiB usable)
Graphics Processor 1: Intel® Graphics
Graphics Processor 2: NVIDIA GeForce RTX 3050 6GB Laptop GPU
Manufacturer: HP
Product Name: Victus by HP Gaming Laptop 15-fa1xxx


ADDITIONAL INFORMATION
The problem is severe because I connect a large external monitor to my laptop. When I maximize a window on the large monitor and then close it while it's still maximized, the next time I open the same application when the external monitor is not connected, the window displays at the large monitor's dimensions but on my small laptop screen. This makes it difficult to resize and is frustrating.
Comment 1 Mahdi Hosseini 2025-11-29 08:34:59 UTC
Created attachment 187237 [details]
My journalctl Err level log file

# journalctl error log level
Comment 2 Mahdi Hosseini 2025-11-29 08:36:08 UTC
Created attachment 187238 [details]
Warning level logs
Comment 3 Zamundaaa 2025-11-29 12:20:48 UTC
KWin doesn't restore window sizes, please report this to the relevant applications.
Comment 4 John 2025-11-29 13:10:06 UTC
I cannot reproduce it with LibreOffice 25.8.3.2 on Debian 14 + KDE Plasma 6.5.3
Not even by opening the LibreOffice Writer afterwards, which seems to have remembered my maximized status preference from the main (general, initial) LibreOffice.
Comment 5 Mahdi Hosseini 2025-11-29 15:48:04 UTC
ترجمه انگلیسی:

Did you follow this exact procedure?

    Open LibreOffice Writer.

    Minimize its size (or make the window smaller).

    Maximize it, and then close it.

And then open Writer again:

Is the window size small, like in the second step?
Comment 6 Mahdi Hosseini 2025-11-29 15:50:58 UTC
I'm Trying to Record a video
Comment 7 Mahdi Hosseini 2025-11-29 15:55:00 UTC
Created attachment 187250 [details]
A video regarding this issue.
Comment 8 Mahdi Hosseini 2025-11-29 16:14:12 UTC
Created attachment 187251 [details]
Look
Comment 9 Mahdi Hosseini 2025-11-29 16:25:47 UTC
(In reply to Zamundaaa from comment #3)
> KWin doesn't restore window sizes, please report this to the relevant
> applications.

Several applications like Blender, Telegram Desktop, and LibreOffice are affected by this issue. Does it have any relation to KWin? I have reported it for LibreOffice but haven't received a reply yet.
Comment 10 Zamundaaa 2025-12-05 16:56:28 UTC
No relation to KWin, no. At least until the session restoration protocol is merged and implemented by these apps, it's completely up to each app to restore these properties correctly.