I am encountering a weird issue that seems to be caused by KWin5 (X11 AND Wayland). NB: it has nothing to do with Plasma’s session restore.
When Firefox’s session restore is enabled and the browser is configured to show the standard titlebar, windows are downsized vertically each time they’re restored after a browser restart. The amount corresponds roughly to either 1x or 2x the height of the titlebar.
This happens no matter how I impose titlebars on FF windows; be it via the browser setting; a special KWin application rule or via gtk3-nocsd.
I thought this was a pure Firefox bug, but it doesn’t happen when I run Xfwm4 (under a KDE environment).
I’ve now seen it in KWin4 and KWin5 5.15.5 and whatever (quite) newer version is in Devuan Chimaera. Testing under Wayland was done on under Devuan. I use the window decoration theme from Oxygen.
It only happens though after I exited the browser properly, not after an unexpected exit. It also happens on second instance, meaning that windows appear first at what appears to be the correct size, and then something changes their geometry. I think that something can only be FF itself, and apparently it miscalculates the window size OR it uses geometry-setting X11 primitives that KWin handles …“differently”. (I know there several ways to specify window geometry under X11 and that WMs have liberty in interpreting at least some of them … but am surprised that this was copied in Wayland.)
I’m pretty certain that this “touch up” or whatever it is, is done by FF itself, and it makes it impossible to define simple KWin rules to set an initial window size but still let the user resize the windows afterwards.
Ways I found to avoid the issue:
kill the browser instead of exiting properly. This seems to prevent whatever it is that FF does otherwise that causes the downsizing, but still lets my windows appear at (approx.) the correct position AND virtual desktop.
Maximise windows vertically. This one worked for me on a lower-res device, but even on a 1080p monitor I prefer to have properly “floating” windows.
Force KWin to ignore geometry via an app-specific rule. This could work if it didn’t also restore windows at seemingly random positions - which do not even seem to ensure that the window will fit on the screen (and can thus downsize them for that reason).
I could probably patch my KWin copy to ignore only the size components.
Change to Xwfm4 just for launching Firefox, and then change back … (there are a few features in KWin that I need). NB: I didn’t actually test this yet.
Use FF without titlebars. NOT acceptable as this is both ugly and you can’t even get the dropshadows that are crucial for depth hints.
Force a window size via a KWin rule. Also not acceptable as I do want to be able to resize windows. Restoring every window at some (user–selectable) standard size is acceptable though.
Turn off session restore in the browser. Not even a consideration of course, unless there exist extensions for that which are also capable of restoring positions and sending each window to the virtual desktop it was on.
Does anyone else notice this, or can anyone confirm the issue? I realise I’m running older KDE versions but I have a hunch that isn’t really the cause here.
You’re saying you had only a single window, with multiple tabs? I realise that’s not a configuration I tested already, as I always have multiple windows open. Do you get dropshadows around/under your FF windows, or are you using a “flat” look anyway? The height difference I’m seeing when the issue is triggered could be linked to the combined height of those shadow borders above and below the windows’ tops and bottoms (and those borders are 0 when the window is maximised vertically).
I do test with “stock” or mostly stock FF profiles t be certain that “it” has nothing to do with the settings, tweaks, extensions etc in my main profile. It hasn’t occurred to me yet to try a new user account, mostly because I cannot think of anything in my KWin settings that is Firefox-specific.
Are there other, preferably simpler, GTk3-based applications that have their own session restore and that have support for not using the default GTK3 CSD? I checked Epiphany, but it doesn’t have support for turning off CSD, so the only way to obtain a close-to-native look is to force titlebars via a KWin rule AND use the gtk3-nocsd runtime patch. Even with those, windows restore to their proper positions and sizes, as far as I can tell.
if you have multiple windows open, you need to be aware of the order you close them.
if i break off this discussion into its’ own window and then close the main window first before i close this window, i will lose all my open tabs in the main window and the location and size will now be saved as this window.
so when i reopen ff this window comes up where i left it, but my main window with all my open tabs is gone… so i’m not going to test that since i don’t want to lose what i’m working on.
but if i close this window first, and then close my main window… everything but this window will be restored right where i left it, and i can get back to this window from the activities tab of this webpage (it even saved this draft response)
I am not closing windows one by one, of course. In fact, I’m not closing any windows myself, I’m quitting the application via the ^Q or the Quit menu item (I’d show it but can only embed a single image).
I can affirm and ensure you that the feature works: the individual windows I had open will each and all be restored with the tabs that were open in them.
Evidently, if you quit the browser by closing the last window it had open, then that window is the session that will be restored.
Well… I downloaded the Kubuntu 24.04 LiveCD and booted into it under VirtualBox.
The only positive thing I can say is that KWin has gotten a lot better at making the GTk3 CSD look palatable: the thick border has gone, and there’s a dropshadow around the window.
But I fetched the current FF Developer Edition version, installed and ran it, changing only the look to “with titlebar” and activated the “save/restore current session” setting. The only thing I changed in KWin is the decoration: I switched that to Oxygen, which I configured the way I like it (NB: that shouldn’t make a different for FF!).
Then, I created a browser session with 2 windows of the same height, the left one reaching down to the top of the bottom panel, the right one against the top of the screen, and started a quit-restart cycle. Here’s what I got the 7th time I restarted the browser:
ADDENDUM: switched back to the Breeze titlebar decoration (with small buttons) and repeated the experiment. The downsize still occurs, though by an amount that’s a tiny bit smaller. I also discovered that the downsizing seems to “slow down” once the windows reach the size in the screenshot … but that’s not really a consolation.
Tried this in Plasma6 (via the current Kubuntu 26.04 LiveCD). I downloaded the current stable Firefox release (v150) by accident, but I know it’s affected under KWin5/Plasma5 so I didn’t try again with the Developer Edition.
NB: this LiveCD only offers the Wayland backend!!
It seems that the issue is resolved for the titlebar mode, but here’s how the default, CSD mode looks after a bunch of browser restarts:
That window spanned the entire height from the top of the VM screen down to the top of the panel. During a number of restarts it shrunk by a few pixels in height, and then it seems to have stopped (as if a fractional difference is calculated, giving a compensation that decreases until it hits 0 pixels, a bit like what I already observed above).
There’s a new issue here: windows don’t get restored to their correct positions. I haven’t checked if that applies to all applications; I suspect an “improvement” in Plasma6 (the “smart” initial window placement has been removed from KWin too, it seems).