KWin causing Firefox windows to be downsized upon restart with session restore
René J.V. Bertin
rjvbertin at gmail.com
Mon May 4 17:32:12 BST 2026
On Monday May 04 2026 14:20:19 Duncan wrote:
>But I think you're incorrect in specifying *firefox*'s session restore,
>since my experience is that firefox's session restore handles getting back
>the webpages that were running when it crashed, etc, and that it actually
>does that impressively well at a crash, but that it doesn't handle window
>size, etc
I think that it does, at least when restoring a properly shut down session. I'm not convinced a WM can even see the difference between an application exitting properly or not.
>
>IOW, I think it's *kwin's* bug, very likely either the same one I
>experienced back in the day (tho the details of my experience differed but
>the titlebar size difference was the same for both you and I), or another
>related to it, likely with the same root cause.
There are several ways a client can specify window geometry. There are WM hints (which the WM can choose to ignore) and there are more lowlevel primitives that a WM should not ignore (normally). I think I've already seen WM options that give a handle on how it deals with WM hints, but I can't find a general setting for them in KWin. I do remember that I had to tweak my own code in an application that wants perfect control over window positions but I think that was before I used KWin.
The crux here is that neither Firefox nor KWin is doing something inherently wrong, but FF is not taking KWin's "opinion" into account (and given one of the central devs in the Plasma team, "opinion" and enforcing it are very accurate terms).
Either way, it's possible FF doesn't attempt to restore geometry after an improper exit because it knows it didn't have the chance to update the stored geometry data. That seems more likely than it restoring obsolete data (which may not even exist). But that still doesn't explain why my restored windows also end up on the correct virtual desktop automagically, because that does not happen with any of my other windows unless I define a KWin rule for it.
>running into kde/kwin/plasma bugs that have been there for awhile and may
>only have been fixed in this-year-recent kde/plasma6, **IF** it's actually
>session-restore.
And IF it has been fixed...
>different behaviors, via kde window rules, that being ignore requested
>geometry, and obey geometry restrictions.
IIRC I checked with the former (to no avail, as can probably be expected).
But IIRC even imposing an initial window size is of no use because the windows get resized with some delay (idem with the move to the designated virtual desktop). I do want to retain the possibility to resize them myself.
That delay is actually the main reason why I think Firefox does something supposedly smart or helpful itself (after a proper exit). There is no reason for KWin to restore geometry and/or desktop assignment after it opened the window for the 1st time; in fact, many people would see that as a flaw.
>Meanwhile, for me it was happening with other gtk-based apps (pan for
>nntp/news and claws-mail for email and as a feed-reader in particular)
It sounds like your issue was really something with how the titlebars were rendered. In my case it looks more like FF makes an error in the estimated titlebar height. I'm not really certain how you'd determine that property under X11 but if there's no way to query the WM you'd probably have to do some trawling of your window's parental hierarchy and then compare the Y co-ordinates of your actual view and of the window corresponding to the proper outside decoration envelope. I suppose that this hierarchy could differ depending on the decoration theme, and I just realise that the combined height of the dropshadows I have above and under my windows could well have the height by which my windows get downsized.
More information about the kde
mailing list