Shrink window to view

Is there a way to have a window automatically shrink to the view, the way Length::Shrink does for widgets?

Right now the window my application launches in is just the default size, whatever that is. There is some extra space at the bottom, indicating that the window is taller than it needs to be–if I make it resizable, I can drag the bottom up a few inches without any widgets shrinking. My top-level element (in my case it’s a Row) is itself set to shrink to its children (Row::height with Length::Shrink to override Length::Fill strategies in its children), but it seems the window doesn’t care.

I was unable to find a built-in way to apply Length::Shrink-equivalent behavior to the window. The best idea I can come up with is to query the size of the top-level element at some point and manually set the window size to that. Is there a better way that I haven’t found?

On master, you can use the pop widget to get the bounds whenever an element pops into view or whenever it is resized via .on_show and .on_resize

I’m not sure it will work but that’s what I’d try

You should find a way to make the view adapt to the window size, rather than having the window adapt to the view size.

Any hints on how to query the size of the top level element on runtime?

I agree with you that it would be preferable to have some form of Shrink size on the application window itself, but I am also having some trouble making that work. If you managed to get your plan b to work, and you are able to share that, that would be awesome!