Anyone have any good way to require a minimum wind...
# compose-desktop
r
Anyone have any good way to require a minimum window size for the application but still allow it to be resizable?
m
Something like this should work
Copy code
fun main() = application {
    Window(onCloseRequest = ::exitApplication, title = "AppName") {
        LaunchedEffect(Unit) {
            window.minimumSize = // minimum size dimension
        }
    }
}
đź‘€ 1
r
Thanks! I can’t believe I didn’t see that -_-
c
So that should resize the dialog on launch if no initial size is set?
r
@Chris Sinco [G] Yes. I use intrinsic sizing with resizable. If you set the window.minimumSize in a
LaunchedEffect
though you will get some resize stutter on launch, So I do this instead until there is a better workaround:
Copy code
fun main() = application {
    val minWindowSize = remember(density) { Dimension((1280 * density).toInt(), (768 * density).toInt()) }

    Window {
        if (window.minimumSize != minWindowSize) mainWindow.minimumSize = minWindowSize
    }
}