Search code examples
kotlinandroid-jetpack-composekotlin-multiplatform

How can i change the default window dimensions for Kotlin Compose Desktop?


I want to change the size of the window of my Kotlin Compose Desktop application so when it launches its 720p instead of the odd square it is by default. How can i do that?

I have tried this and have looked it up to no avail

fun FrameWindowScope.setMinSize() {
    window.minimumSize = Dimension(1280, 720)
}

Solution

  • You can simply do it like that:

        val state = rememberWindowState(
            width = 300.dp,
            height = 600.dp,
        )
        Window(
            onCloseRequest = ::exitApplication,
            title = "AppName",
            state = state
        ) {
            App()
        }