Windows + 2 Screen -> Did anybody figure out h...
# compose-desktop
i
Windows + 2 Screen -> Did anybody figure out how to lunch the desktop compose window on a specific screen if existing ? :)
🥪 1
👀 1
i
Currently it is possible only if you use Swing directly:
Copy code
import androidx.compose.material.Text
import androidx.compose.ui.awt.ComposeWindow
import java.awt.Dimension
import java.awt.GraphicsDevice
import java.awt.GraphicsEnvironment
import javax.swing.JFrame
import javax.swing.SwingUtilities

fun main() = SwingUtilities.invokeLater {
    val window = ComposeWindow()
    window.size = Dimension(200, 200)
    window.setContent {
        Text("Text")
    }
    window.moveToScreen(GraphicsEnvironment.getLocalGraphicsEnvironment().screenDevices[1])
    window.isVisible = true
}

fun ComposeWindow.moveToScreen(device: GraphicsDevice) {
    val dummy = JFrame(device.defaultConfiguration)
    setLocationRelativeTo(dummy)
    dummy.dispose()
}
We probably need to make another constructor for ComposeWindow, which accepts GraphicsConfiguration, so we don't have to create a dummy JFrame. P.S. A Swing-independent API is possible in the future, but we haven't looked into that yet.
m
I don’t understand the question. How does one “lunch” a window? How does it taste? Sorry, could not resist. 😇
one sec cooking 2
😄 1